PSETEX(3valkey)

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

πŸ’– PSETEX πŸ’–

okay bestie, welcome to psetex β€” it's from the Valkey Command Manual and it's literally the moment your key gets a value and a lil countdown, in milliseconds. slay.


✨ NAME ✨

psetex β€” sets both the string value and the expiration time in milliseconds of a key. the key gets created if it doesn't exist yet. no cap. πŸŽ€


🌸 SYNOPSIS 🌸

PSETEX key milliseconds value

πŸ¦‹ DESCRIPTION πŸ¦‹

so here's the tea: PSETEX works exactly like SETEX with one (1) single difference β€” the expire time is given in milliseconds instead of seconds. that's it. that's the whole glow-up. ⏱️

πŸ’… Alternative

you could also just use SET with the PX argument. same vibe, different font. 🫢


πŸ’Œ REPLY πŸ’Œ

valkey-protocol(7) Simple string reply: OK.

that's the whole reply. iconic behavior honestly.


⚑ COMPLEXITY ⚑

O(1) β€” constant time, she's fast, she's efficient, she's not doing anything extra. πŸ‘‘


πŸ” ACL CATEGORIES πŸ”

  • @slow
  • @string
  • @write

πŸ“œ HISTORY πŸ“œ

  • Available since: 2.6.0 β€” an elder, a legend, a founding mother. ⭐

πŸ“ EXAMPLES πŸ“

watch her work:

127.0.0.1:6379> PSETEX mykey 1000 "Hello"
OK
127.0.0.1:6379> PTTL mykey
(integer) 990
127.0.0.1:6379> GET mykey
"Hello"

like… 1000 ms later and PTTL is already down to 990?? the way time just moves. πŸ˜­πŸ•°οΈ


🌈 SEE ALSO 🌈

the whole friend group, fr fr:


and that's the whole page bestie πŸ’– this was version 9.0.0, dated 2025-10-21, from the Valkey Command Manual. go set a key with a millisecond timer on it, you absolute main character. periodt. πŸ’…βœ¨

πŸ“¦ where this page comes from