BLESS SCAN

BLESS SCAN cursor NO-EVICT [COUNT count]
Available since:
Redis Open Source 8.12.0
Time complexity:
O(1) for every call. O(N) for a complete iteration, where N is the number of blessed keys.
ACL categories:
@keyspace, @slow,
Compatibility:
Redis Software and Redis Cloud compatibility

BLESS SCAN incrementally iterates the blessed keys of the current database that carry the given protection flag, using the same cursor-based protocol as SCAN.

Required arguments

cursor

The cursor value. Start an iteration with 0, then use the cursor returned by each call as the argument to the next call.

NO-EVICT

The protection flag to filter by. NO-EVICT is currently the only supported flag, and this argument is required.

Optional arguments

COUNT count

A hint for the number of keys to visit per iteration. The default is 1024.

Details

BLESS SCAN follows the same cursor semantics and iteration guarantees as SCAN: a full iteration, from cursor 0 until the returned cursor is 0 again, is guaranteed to return every key that carried the given flag for the entire duration of the iteration. COUNT is only a hint, and a key may be returned more than once during a full iteration.

Examples

redis> SET session:42 "some value"
OK
redis> SET cache:100 "some value"
OK
redis> BLESS SET session:42 NO-EVICT
(integer) 1
redis> BLESS SET cache:100 NO-EVICT
(integer) 1
redis> BLESS SCAN 0 NO-EVICT
1) "0"
2) 1) "cache:100"
   2) "session:42"

Redis Software and Redis Cloud compatibility

Redis
Software
Redis
Cloud
Notes
❌ Standard
❌ Active-Active
❌ Standard
❌ Active-Active

Return information

Array reply: specifically, an array with two elements.

  • The first element is a Bulk string reply that represents an unsigned 64-bit number, the cursor.
  • The second element is an Array reply with the names of the scanned keys.

See also

BLESS SET | BLESS CLEAR | BLESS GET

RATE THIS PAGE
Back to top ↑