ttl
TTL seconds
Remaining expire time in seconds
Usage: ttl key [type].
Returns -2 if the key does not exist, and -1 if no expire time is set.
📍 type is one of string/list/set/zset/hash/stream.
type was added in ent811. Use it.
Example
| Command> | set key value |
| Result> | 1 |
| Command> | expire key 5 string |
| Result> | 1 |
| Command> | ttl key string |
| Result> | 3 |
| Command> | ttl key string |
| Result> | -2 |
| Command> | get key |
| Result> | (nil) |
Syntax
TTL key [type]
- Available since version 1.0.0.
- Time complexity is O(1).
- ent811: type argument added.