PERSIST(3valkey)
β¨ 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:
- valkey-protocol(7) Integer reply:
0if key does not exist or does not have an associated timeout. - valkey-protocol(7) Integer reply:
1if the timeout has been removed.
β 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 π
- 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)
- pexpire(3valkey)
- pexpireat(3valkey)
- pexpiretime(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)
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
- fedora 44: valkey-doc 9.0.3-2.fc44 Β· CC-BY-SA-4.0
- fedora 44: valkey-doc 9.0.6-1.fc44 Β· CC-BY-SA-4.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms