PTTL
Syntax
PTTL key
Time complexity: O(1)
ACL categories: @keyspace, @read, @fast
Like TTL this command returns the remaining time to live of a key that has an
expire set, with the sole difference that TTL returns the amount of remaining
time in seconds while PTTL returns it in milliseconds.
Return
Integer reply: TTL in milliseconds, 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
dragonfly> SET mykey "Hello"
OK
dragonfly> EXPIRE mykey 1
(integer) 1
dragonfly> PTTL mykey
(integer) 1000