TTL
Syntax
Section titled “Syntax”TTL key
TTL returns the remaining time to live (in seconds) of a key that has an expiration set.
- Returns -1 if the key has no expiration.
- Returns -2 if the key does not exist.
Examples
Section titled “Examples”localhost:7379> SET k 43OKlocalhost:7379> TTL kOK -1localhost:7379> SET k 43 EX 10OKlocalhost:7379> TTL kOK 8localhost:7379> TTL knOK -2