Skip to content

Ask the HotKV docs

Answers come only from these docs and can be wrong; check the linked pages before you rely on them.

PEXPIRETIME

Last updated
PEXPIRETIME key
Group
Keys
Complexity
O(1)
Arity
2 (exactly, counting the command name)
Flags
read-only, fast
Keys
first 1, last 1, step 1
HotKV Cloud
All plans
On-Premise
no license needed

PEXPIRETIME returns the absolute Unix timestamp, in milliseconds, at which key will expire. Reading it is not an access to the key.

Case RESP2 RESP3
The key has a time to live Integer: Unix time in milliseconds Integer
The key exists without a time to live Integer -1 Integer -1
The key does not exist Integer -2 Integer -2
127.0.0.1:6379> SET report "q3"
OK
127.0.0.1:6379> PEXPIREAT report 1893456000000
(integer) 1
127.0.0.1:6379> PEXPIRETIME report
(integer) 1893456000000

Same as Redis 7 and Valkey 8.

EXPIRETIME, PEXPIREAT, PTTL