DELEX

Since 1.1.0Strings

Syntax

DELEX key [IFEQ val | IFNE val | IFDEQ digest | IFDNE digest]
  • Flags: write
  • ACL categories: @slow, @string, @write
  • Arity: -2

Deletes key, optionally only if its string value, or the value's digest, matches. The comparison and the deletion happen in one step.

Options

OptionDelete only if
IFEQ valuethe value equals value
IFNE valuethe value differs from value
IFDEQ digestthe value's digest equals digest
IFDNE digestthe value's digest differs from digest

Without a condition, DELEX deletes a key of any type, like DEL.

Reply

  • 1 if the key was deleted.
  • 0 if the key does not exist, or the condition was not met.
  • ERR Key should be of string type if conditions are specified if 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