Redis参考手册
Hashes
hincrby
HINCRBY key field increment
自2.0.0起可用。
时间复杂度: O(1)
递增field
存储在key
by 处的散列中的数字increment
。如果key
不存在,则创建一个保存散列的新密钥。如果field
不存在,则0
在执行操作之前将该值设置为。
HINCRBY 支持的值范围限于64位有符号整数。
返回值
整数回复:field
递增操作后的值。
例子
自increment
变量被签名后,可以执行递增和递减操作:
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
Hashes相关
Redis 是一个开源的使用 ANSI C 语言编写、遵守 BSD 协议、支持网络、可基于内存亦可持久化的日志型、Key-Value 数据库,并提供多种语言的 API。 它通常被称为数据结构服务器,因为值( value )可以是 字符串( String ), 哈希(Map),列表(list),集合( sets ) 和 有序集合( sorted sets )等类型。
主页 | https://redis.io/ |
源码 | https://github.com/antirez/redis |
发布版本 | 4.0.2 |