Redis Set SSCAN Command
The Redis SSCAN
command is used to iterate over the elements of a set. It is based on the SCAN
command.
Syntax
The basic syntax of the SSCAN
command is as follows:
1 | SSCAN key cursor [MATCH pattern] [COUNT count] |
Available Since
Redis version >= 2.8.0
Time Complexity
O(1) for every call.
O(N) for a complete iteration, including enough command calls for the cursor to return back to 0. N is the number of elements inside the collection.
ACL Categories
@read
, @set
, @slow
Return Value
Returns an array. 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 scanned members.
Example
1 | 127.0.0.1:6379> SADD myset Johnson Jack Tim Paul |
All articles on this blog are licensed under CC BY-NC-SA 4.0 unless otherwise stated.