DELEX
Since 1.1.0Strings
Syntax
DELEX key [IFEQ val | IFNE val | IFDEQ digest | IFDNE digest]Deletes key, optionally only if its string value, or the value's digest, matches. The comparison and the deletion happen in one step.
Options
| Option | Delete only if |
|---|---|
IFEQ value | the value equals value |
IFNE value | the value differs from value |
IFDEQ digest | the value's digest equals digest |
IFDNE digest | the value's digest differs from digest |
Without a condition, DELEX deletes a key of any type, like DEL.
Reply
1if the key was deleted.0if the key does not exist, or the condition was not met.ERR Key should be of string type if conditions are specifiedif a condition is given and the key is not a string.
Examples
> SET d hello
OK
> DELEX d IFEQ nope
(integer) 0
> DELEX d IFEQ hello
(integer) 1
> SET d hello
OK
> DELEX d IFDEQ 9555e8555c62dcfd
(integer) 1