GETDEL · Valkey

GETDEL

Returns the string value of a key after deleting the key.

Usage

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:

Reply RESP3

One of the following:

Complexity

O(1)

ACL Categories

@fast @string @write

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)

History

See also

APPEND, DECR, DECRBY, GET, GETEX, GETRANGE, INCR, INCRBY, INCRBYFLOAT, LCS, MGET, MSET, MSETNX, SET, SETRANGE, STRLEN.