decr

UK['dɪkr] US['dɪkr]

abbr.decrease reduce; become less; decrement(al)(ly) reduce; reduce Value

by

UK[baɪ] US[baɪ]

prep.beside...;expression;because;after

adv. pass; means to reserve or save; use; to visit briefly

redis DECRBY command syntax

Function:Subtract the decrement from the value stored in key.

Syntax:DECRBY key decrement

Description:If key does not exist, then the value of key will be initialized to 0 first, and then executed DECRBY operation. If the value contains the wrong type, or a value of type string cannot be represented as a number, an error is returned. The value of this operation is limited to 64-bit signed number representation.

Available versions:>= 1.0.0

Time complexity:O(1)

Return:The value of key after subtracting decrement.

redis DECRBY command example

# 对已存在的 key 进行 DECRBY redis> SET count 100 OK redis> DECRBY count 20 (integer) 80 # 对不存在的 key 进行DECRBY redis> EXISTS pages (integer) 0 redis> DECRBY pages 10 (integer) -10