TTL
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
localhost:7379> SET k 43OK OKlocalhost:7379> TTL kOK -1localhost:7379> SET k 43 EX 10OK OKlocalhost:7379> TTL kOK 9localhost:7379> TTL knOK -2