GETDEL(3valkey)
π GETDEL π
okay bestie, welcome to the Valkey Command Manual β yes, the valkey manual, the one and only. today's main character is getdel, and she is serving. sit down, grab a strawberry π, and let's get into it.
β¨ NAME β¨
getdel β grabs the string value of a key and then yeets the key into the void. value first, deletion second. no take-backs.
πΈ SYNOPSIS πΈ
GETDEL key
that's it. one key. that's the whole vibe. π
π¦ DESCRIPTION π¦
okay so. GETDEL does the thing: it gets the value of key and deletes the key. boom. two-for-one.
it's basically GET's chaotic twin, except for the fact that it also deletes the key on success β and listen, the "on success" is doing a LOT of work there, because it only happens if and only if the key's value type is a string. not a list, not a hash, not a set. a string. periodt. π
π REPLY π
RESP2
one of these two, bestie:
valkey-protocol(7)Bulk string reply: the value of the key.valkey-protocol(7)Nil reply: if the key does not exist or if the key's value type is not a string.
RESP3
and in RESP3, one of these:
valkey-protocol(7)Bulk string reply: the value of the key.valkey-protocol(7)Null reply: if the key does not exist or if the key's value type is not a string.
not me pointing out that RESP2 says Nil and RESP3 says Null β yes they're different words, yes it matters, no you can't just swap them. iykyk. π
π COMPLEXITY π
constant time. instant. lightning. she does not care how big your keyspace is. ate. π₯
π ACL CATEGORIES π
@fast @string @write
β HISTORY β
- Available since:
6.2.0
π§ EXAMPLES π§
127.0.0.1:6379> SET mykey "Hello"
OK
127.0.0.1:6379> GETDEL mykey
"Hello"
127.0.0.1:6379> GET mykey
(nil)
see how the last GET comes back (nil)? that's because GETDEL already took her out. gone. evaporated. the key is not there anymore, bestie, and that's the whole point. π«Ά
π SEE ALSO π
append(3valkey), decr(3valkey), decrby(3valkey), delifeq(3valkey), get(3valkey), getex(3valkey), getrange(3valkey), getset(3valkey), incr(3valkey), incrby(3valkey), incrbyfloat(3valkey), lcs(3valkey), mget(3valkey), mset(3valkey), msetnx(3valkey), psetex(3valkey), set(3valkey), setex(3valkey), setnx(3valkey), setrange(3valkey), strlen(3valkey), substr(3valkey)
and that's the page, babe. this whole thing is from version 9.0.0, dated 2025-10-21 β so if you're reading this from a future that's moved on without us, no cap, check the version. 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