Skip to content

Instantly share code, notes, and snippets.

@emperorcezar
Created September 10, 2018 17:45
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 emperorcezar/ef2629f71c7c3c5d5b0b98b3b6250e2d to your computer and use it in GitHub Desktop.
Save emperorcezar/ef2629f71c7c3c5d5b0b98b3b6250e2d to your computer and use it in GitHub Desktop.
Print TTLs from Redis for a set of keys in a file
import fire
import redis
import time
def print_ttl(redis_host, keyfile)
r = redis.Redis(host=redis_host)
with open(keyfile) as f:
for key in f:
if not r.exists(key):
continue
print('{} - {}'.format(key, r.ttl(key)))
time.sleep(0.1) # Lets not overload redis
if __name__ == '__main__':
fire.Fire(print_ttl)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment