w3resource

Redis String: DECRBY

DECRBY key decrement

Redis DECRBY command is used to decrement the number stored at key by specified value. If the key does not exist, it is set to 0 before performing the operation. If the key contains a value of the wrong type or contains a string that can not be represented as integer an error is returned.

Syntax:

DECRBY KEY_NAME DECREMENT_AMOUNT

Available since

1.0.0.

Return Value

Integer reply, the value of key after the increment

Return Value Type

Integer

Example: Redis DECRBY

redis 127.0.0.1:6379> SET visitors 1000
OK
redis 127.0.0.1:6379> DECRBY visitors 5
(integer) 995

Previous: DECR
Next: APPEND



Follow us on Facebook and Twitter for latest update.