class Redis

def scan_each(**options, &block)

Returns:
  • (Enumerator) - an enumerator for all found keys

Parameters:
  • options (Hash) --

Other tags:
    Example: Execute block for each key of a type -
    Example: Execute block for each key matching a pattern -
    Example: Retrieve all of the keys (with possible duplicates) -
def scan_each(**options, &block)
  return to_enum(:scan_each, **options) unless block_given?
  cursor = 0
  loop do
    cursor, keys = scan(cursor, **options)
    keys.each(&block)
    break if cursor == "0"
  end
end