TTL
Since 1.1.0Keys
Syntax
TTL keyReturns how long key has before it expires, in seconds.
Reply
- The seconds left.
-1if the key has no expiry.-2if the key does not exist.
Examples
> SET a 1 EX 100
OK
> TTL a
(integer) 100
> PERSIST a
(integer) 1
> TTL a
(integer) -1
> TTL missing
(integer) -2