DELEX · Valkey

DELEX

Delete a key conditionally based on its value.

Usage

DELEX key <IFEQ | IFNE> value

Description

Delete key based on condition.

Options

Reply

One of the following:

Complexity

O(1)

ACL Categories

@fast @string @write

Example

Delete the key if given value is equal to existing value.

127.0.0.1:6379> SET x 1
OK
127.0.0.1:6379> DELEX x IFEQ 1
(integer) 1

Delete the key if given value is not equal to existing value.

127.0.0.1:6379> SET x 1
OK
127.0.0.1:6379> DELEX x IFNE 2
(integer) 1

History

See also

APPEND, DECR, DECRBY, DELIFEQ, GET, GETDEL, GETEX, GETRANGE, GETSET, INCR, INCRBY, INCRBYFLOAT, INCREX, LCS, MGET, MSET, MSETEX, MSETNX, PSETEX, SET, SETEX, SETNX, SETRANGE, STRLEN, SUBSTR.