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
# 對(duì)已存在的 key 進(jìn)行 DECRBY redis> SET count 100 OK redis> DECRBY count 20 (integer) 80 # 對(duì)不存在的 key 進(jìn)行DECRBY redis> EXISTS pages (integer) 0 redis> DECRBY pages 10 (integer) -10