TTL
Since 1.1.0KeysChanged in 1.2.1
Syntax
TTL keyHistory
- 1.2.1: acl categories: removed generic
Returns how long key has before it expires, in seconds, rounded to the nearest second, as in Redis: a key with 1,499 milliseconds left has 1. Before 1.2.1 it rounded up, to 2. PTTL gives the milliseconds.
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