Skip to content

DECR

DECR key

DECR command decrements the integer at ‘key’ by one. Creates ‘key’ as -1 if absent. The command raises an error if the value is a non-integer.

Returns the new value of ‘key’ on success.

localhost:7379> SET k 43
OK
localhost:7379> DECR k
OK 42
localhost:7379> DECR k1
OK -1
localhost:7379> SET k2 v
OK
localhost:7379> DECR k2
ERR wrongtype operation against a key holding the wrong kind of value