How to Delete a Key Only If Its Value Matches in Valkey (DELEX)
Delete a Valkey key only if it holds the value you expect, with DELEX on Valkey 9.2 or DELIFEQ on 9.0 and 9.1.
- Database
- Valkey
Delete a Valkey key only if it holds the value you expect, with DELEX on Valkey 9.2 or DELIFEQ on 9.0 and 9.1.
Keep a Valkey counter between two limits with INCREX: refuse a change that goes too far, or stop exactly at the limit with SATURATE.
Add to the end of a Valkey string with APPEND, read part of it with GETRANGE and overwrite part of it with SETRANGE.
Save several keys in Valkey with one shared expiry using MSETEX, so short-lived values such as one-time codes disappear on their own.
Save several keys in one command with Valkey’s MSET, read several at once with MGET, and use MSETNX to save only if none of them exist.
Add a decimal number such as 1.25 to a value in Valkey with INCRBYFLOAT, or subtract one with a negative number.
Count up and down in Valkey with INCR and DECR, and by more than one with INCRBY and DECRBY.
Change a Valkey key only if it still holds the value you expect, with SET IFEQ, and refuse a change with SET IFNE.
Save a value in Valkey only if its key doesn’t exist yet, with SET NX, so the first claim wins and nothing is overwritten.
What each option of Valkey’s SET command does, run live on one key: NX, XX, GET, IFEQ, IFNE, EX and KEEPTTL.