PEXPIRETIME(3valkey)

πŸ“¦
version 9.0.6 Β· 2 versions
, in fedora 44

πŸ’– PEXPIRETIME πŸ’–

okay bestie, this is a page from the Valkey Command Manual, and honestly? it's a little icon. let's get into it 🫢


✨ NAME ✨

pexpiretime β€” returns the expiration time of a key as a Unix milliseconds timestamp. yes, milliseconds. we're precise in this house πŸ’…


✨ SYNOPSIS ✨

PEXPIRETIME key

✨ DESCRIPTION ✨

so here's the tea: PEXPIRETIME has the exact same semantic as EXPIRETIME from valkey-expiretime(7), no cap. the ONE difference? it hands you back the absolute Unix expiration timestamp in milliseconds instead of seconds. that's it. that's the whole vibe. millis not secs. πŸ¦‹


✨ REPLY ✨

you're gonna get one of these three, and only these three, periodt:

  • valkey-protocol(7) Integer reply β€” the expiration Unix timestamp in milliseconds. slay, you got a real number ✨
  • valkey-protocol(7) Integer reply β€” -1 if the key exists but has no associated expiration time. she's alive but she's immortal, no clock on her πŸ’€
  • valkey-protocol(7) Integer reply β€” -2 if the key does not exist. not me finding out she was never there 😭

✨ COMPLEXITY ✨

O(1) β€” constant time, instant, no waiting around. it's giving main character speed πŸ‘‘


✨ ACL CATEGORIES ✨

@fast @keyspace @read


✨ HISTORY ✨

  • Available since: 7.0.0 πŸŽ€

✨ EXAMPLES ✨

here's the whole thing in action, live from 127.0.0.1:6379:

127.0.0.1:6379> SET mykey "Hello"
OK
127.0.0.1:6379> PEXPIREAT mykey 33177117420000
(integer) 1
127.0.0.1:6379> PEXPIRETIME mykey
(integer) 33177117420000

set it, give it a big ol' millisecond deadline, then ask for the receipt. iconic behavior fr fr πŸ”₯


✨ SEE ALSO ✨

go read these next bestie, they're all connected:

copy(3valkey), del(3valkey), dump(3valkey), exists(3valkey), expire(3valkey), expireat(3valkey), expiretime(3valkey), keys(3valkey), migrate(3valkey), move(3valkey), object(3valkey), object-encoding(3valkey), object-freq(3valkey), object-help(3valkey), object-idletime(3valkey), object-refcount(3valkey), persist(3valkey), pexpire(3valkey), pexpireat(3valkey), pttl(3valkey), randomkey(3valkey), rename(3valkey), renamenx(3valkey), restore(3valkey), scan(3valkey), sort(3valkey), sort_ro(3valkey), touch(3valkey), ttl(3valkey), type(3valkey), unlink(3valkey), wait(3valkey), waitaof(3valkey)


ok that's the whole page!! go forth and check your expiration times in milliseconds, you absolute legend πŸ’–

version 9.0.0 Β· dated 2025-10-21 β€” mwah, catch you in the next manpage bestie 🧚✨🌸

πŸ“¦ where this page comes from