Module Hub Beta
CHECKANDkey value [XX]
Checks a String ‘key’ for ‘value’ equality and executes a command on it. Command can be any of the following Redis String commands: APPEND, DECR[BY] GETSET, INCR[BY], INCRBYFLOAT, PSETEX, SET[EX|NX]. The XX flag means that the key must exist for the equality to be evaluated.
Note: the key shouldn’t be repeated for the executed command.
Null if not equal or for non existing key when the
XX flag is used. On success, the reply depends on the actual command executed.
redis> SET mykey “Hello World”
redis> CHECKAND mykey “Hello World” SET mykey “Hello Redis Modules”
redis> GET mykey
“Hello Redis Modules”