PERSIST(3valkey)

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

✨ PERSIST(3valkey) ✨

okay bestie, so this is PERSIST, straight out of the Valkey Command Manual πŸ’– and honestly? it's giving "let her live forever" energy.


🌸 NAME 🌸

persist β€” Removes the expiration time of a key.


πŸŽ€ SYNOPSIS πŸŽ€

PERSIST key

πŸ’… DESCRIPTION πŸ’…

so like, imagine your key has a timer on it. a little countdown, ticking away, about to go poof πŸ’€. PERSIST is the girl who walks in and smashes the clock. β°βœ‹

It removes the existing timeout on key, turning the key from volatile (a key with an expire set) into persistent (a key that will never expire as no timeout is associated). no cap. she's immortal now. πŸ‘‘βœ¨


πŸ¦‹ REPLY πŸ¦‹

One of the following:


⭐ COMPLEXITY ⭐

O(1) β€” literally instant, main character speed, no waiting around πŸƒβ€β™€οΈπŸ’¨


🌈 ACL CATEGORIES 🌈

@fast @keyspace @write


πŸ’œ HISTORY πŸ’œ

  • Available since: 2.2.0 β€” she's been iconic for a minute 🫢

πŸ”₯ EXAMPLES πŸ”₯

127.0.0.1:6379> SET mykey "Hello"
OK
127.0.0.1:6379> EXPIRE mykey 10
(integer) 1
127.0.0.1:6379> TTL mykey
(integer) 10
127.0.0.1:6379> PERSIST mykey
(integer) 1
127.0.0.1:6379> TTL mykey
(integer) -1

see how the TTL went from 10 to -1? that's the "no timeout, she's free" signal πŸ’–


πŸ‘‘ SEE ALSO πŸ‘‘


and that's the whole vibe, bestie β€” go forth and make your keys immortal πŸ’–βœ¨ no expiration, no problems, periodt πŸŽ€

version 9.0.0 Β· dated 2025-10-21 Β· mwah πŸ’‹

πŸ“¦ where this page comes from