9951 explained code solutions for 126 technologies


python-redisGet key TTL in Redis


r = redis.Redis()
seconds = r.ttl('a')ctrl + c
redis.Redis

connect to Redis server

r.ttl(

returns number of seconds left for a key to live

'a'

key to get TTL for

seconds

variable will store seconds to live