?
This document uses PHP Chinese website manual Release
HINCRBY key field increment
自2.0.0起可用。
時(shí)間復(fù)雜度: O(1)
遞增field
存儲在key
by 處的散列中的數(shù)字increment
。如果key
不存在,則創(chuàng)建一個保存散列的新密鑰。如果field
不存在,則0
在執(zhí)行操作之前將該值設(shè)置為。
HINCRBY 支持的值范圍限于64位有符號整數(shù)。
整數(shù)回復(fù):field
遞增操作后的值。
自increment
變量被簽名后,可以執(zhí)行遞增和遞減操作:
redis> HSET myhash field 5 (integer) 1
redis> HINCRBY myhash field 1 (integer) 6
redis> HINCRBY myhash field -1 (integer) 5
redis> HINCRBY myhash field -10 (integer) -5