EXPIRETIME
Syntax
EXPIRETIME key
Time complexity: O(1)
ACL categories: @keyspace, @write, @fast
Returns the absolute Unix timestamp (since January 1, 1970) in seconds at which the given key will expire.
See also the PEXPIRETIME
command which returns the same information with milliseconds resolution.
Return
Integer reply, specifically:
- The expiration Unix timestamp, in seconds.
-1
if the key exists but has no expiration time.-2
if the key does not exist.
Examples
dragonfly> SET mykey "Hello"
OK
dragonfly> EXPIRETIME mykey
(integer) -1
dragonfly> EXPIRETIME missing
(integer) -2
dragonfly> EXPIRE mykey 100
(integer) 1
dragonfly> EXPIRETIME mykey
(integer) 1755753267