getdel.3valkey - Man Page
Returns the string value of a key after deleting the key.
Synopsis
GETDEL
key
Description
Get the value of key
and delete the key. This command is similar to GET
, except for the fact that it also deletes the key on success (if and only if the key’s value type is a string).
Reply
Resp2
One of the following:
- 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
One of the following:
- 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.
Complexity
O(1)
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 Also
append(3valkey), decr(3valkey), decrby(3valkey), get(3valkey), getex(3valkey), getrange(3valkey), incr(3valkey), incrby(3valkey), incrbyfloat(3valkey), lcs(3valkey), mget(3valkey), mset(3valkey), msetnx(3valkey), set(3valkey), setrange(3valkey), strlen(3valkey)
Info
2024-09-23 8.0.0 Valkey Command Manual