GETDEL(3valkey)

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

πŸ’– 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:

RESP3

and in RESP3, one of these:

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 πŸŽ€

O(1)

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