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:

Resp3

One of the following:

Complexity

O(1)

Acl Categories

@fast @string @write

History

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