String
DECR
Decrement the integer value of a key by one
await redis.set("key", 6);
await redis.decr("key");
// returns 5
If a key does not exist, it is initialized as 0 before performing the operation. An error is returned if the key contains a value of the wrong type or contains a string that can not be represented as integer.
Arguments
key
string
requiredThe key to decrement.
Response
The value at the key after the decrementing.
await redis.set("key", 6);
await redis.decr("key");
// returns 5