Created
February 6, 2015 18:16
-
-
Save bpo/5881dac9500a68039d0a to your computer and use it in GitHub Desktop.
Scan for all keys with no expiration.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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