Skip to content

Instantly share code, notes, and snippets.

@bpo
Created February 6, 2015 18:16
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 bpo/5881dac9500a68039d0a to your computer and use it in GitHub Desktop.
Save bpo/5881dac9500a68039d0a to your computer and use it in GitHub Desktop.
Scan for all keys with no expiration.
redis = Redis.new(url: REDISGREEN_URL)
cursor = 0
while true do
cursor, keys = redis.scan(cursor)
if keys.size < 1
break
end
keys.each do |key|
ttl = redis.ttl(key)
if ttl == -1
p "#{key}"
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment