Redis

TTL key

Returns the remaining time to live of a key that has a timeout. This introspection capability allows a Redis client to check how many seconds a given key will continue to be part of the dataset.

Return value

Integer reply: TTL in seconds, -2 when key does not exist or -1 when key does not have a timeout.

Examples

redis>  SET mykey "Hello"
OK
redis>  EXPIRE mykey 10
(integer) 1
redis>  TTL mykey
(integer) 10
redis> 
Comments powered by Disqus