TTL
Syntax
1. TTL key
Time complexity: O(1)
Returns the remaining time to live of a key that has a timeout. This introspection capability allows a Dragonfly client to check how many seconds a given key will continue to be part of the dataset.
Return
Integer reply: TTL in seconds, or a negative value in order to signal an error.
- The command returns
-2if the key does not exist. - The command returns
-1if the key exists but has no associated expire.
Examples
1. dragonfly> SET mykey "Hello"
2. "OK"
3. dragonfly> EXPIRE mykey 10
4. (integer) 1
5. dragonfly> TTL mykey
6. (integer) 10
