pttl
PTTL milliseconds
Get the remaining expire time in milliseconds
Usage: pttl key [type].
Returns -2 if the key was deleted, and -1 if no expire time is set.
type is one of string/list/set/zset/hash/stream.
The type argument was added in ent811. Please use it.
Example
| Command> | set key value |
| Result> | 1 |
| Command> | pexpire key 5000 string |
| Result> | 1 |
| Command> | pttl key string |
| Result> | 3546 |
| Command> | pttl key string |
| Result> | -2 |
| Command> | get key |
| Result> | (nil) |
Syntax
PTTL key [type]
- Available since version 2.6.0.
- Time complexity is O(1).
- The type argument was added in ent811.