Created
September 10, 2018 17:45
-
-
Save emperorcezar/ef2629f71c7c3c5d5b0b98b3b6250e2d to your computer and use it in GitHub Desktop.
Print TTLs from Redis for a set of keys in a file
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
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