Method: Redis::Commands::Keys#scan_each
- Defined in:
- lib/redis/commands/keys.rb
#scan_each(**options, &block) ⇒ Enumerator
Scan the keyspace
See the [Redis Server SCAN documentation](redis.io/docs/latest/commands/scan/) for further details
53 54 55 56 57 58 59 60 61 62 |
# File 'lib/redis/commands/keys.rb', line 53 def scan_each(**, &block) return to_enum(:scan_each, **) unless block_given? cursor = 0 loop do cursor, keys = scan(cursor, **) keys.each(&block) break if cursor == "0" end end |