Method: Redis::Commands::Keys#scan

Defined in:
lib/redis/commands/keys.rb

#scan(cursor, **options) ⇒ String+

Scan the keyspace

See the Redis Server SCAN documentation for further details

Examples:

Retrieve the first batch of keys

redis.scan(0)
  # => ["4", ["key:21", "key:47", "key:42"]]

Retrieve a batch of keys matching a pattern

redis.scan(4, :match => "key:1?")
  # => ["92", ["key:13", "key:18"]]

Retrieve a batch of keys of a certain type

redis.scan(92, :type => "zset")
  # => ["173", ["sortedset:14", "sortedset:78"]]


27
28
29
# File 'lib/redis/commands/keys.rb', line 27

def scan(cursor, **options)
  _scan(:scan, cursor, [], **options)
end