Skip to content

Instantly share code, notes, and snippets.

@pguelpa
Created February 4, 2015 02:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pguelpa/5c13fa5949dd995c042d to your computer and use it in GitHub Desktop.
Save pguelpa/5c13fa5949dd995c042d to your computer and use it in GitHub Desktop.
Ruby / Redis + iterate through keys
iterator = nil
keys = []
while iterator != '0'
iterator, list = Redis.current.scan(iterator || 0, count: 1000)
keys += list.map { |l| l.split(':') }
puts "Found another #{list.length} keys, iterator at #{iterator}"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment