client.redis.keys
List RedisOS keys by pattern.
Signature
class Client {
redis: {
keys(opts?: { prefix?: string }): Promise<{ keys: string[]; cursor: string }>
}
}
Parameters
| Name | Type | Required | Notes |
|---|---|---|---|
| string | no | Key prefix to filter by |
Examples
const { keys } = await bf.redis.keys({ prefix: 'session:' })
keys.forEach(k => console.log(k))
Throws
| Error | Condition |
|---|---|
| API request failed |
| Network issue |
Pitfalls
- Pagination — use the returned
for paginated iteration (not yet implemented; currently returns all matching keys)cursor - Performance — on large datasets with many keys, scanning without a prefix may be slow
See also
{auto-injected}
Tested against
{auto-injected}