Redis Zincrby 命令

更新时间: 2019-07-07 15:54

Redis Zincrby 命令对有序集合中指定成员的分数加上增量 increment

可以通过传递一个负数值 increment ,让分数减去相应的值,比如 ZINCRBY key -5 member ,就是让 member 的 score 值减去 5 。

当 key 不存在,或分数不是 key 的成员时, ZINCRBY key increment member 等同于 ZADD key increment member 。

当 key 不是有序集类型时,返回一个错误。

分数值可以是整数值或双精度浮点数。

语法

redis 127.0.0.1:6379> ZINCRBY key increment member

返回值

member 成员的新分数值,以字符串形式表示。

实例

redis> ZADD myzset 1 "one"
(integer) 1
redis> ZADD myzset 2 "two"
(integer) 1
redis> ZINCRBY myzset 2 "one"
"3"
redis> ZRANGE myzset 0 -1 WITHSCORES
1) "two"
2) "2"
3) "one"
4) "3"
redis> 

查看更多 Redis 有序集合(sorted set)命令

Parsing Techniques

Parsing Techniques

Dick Grune、Ceriel J.H. Jacobs / Springer / 2010-2-12 / USD 109.00

This second edition of Grune and Jacobs' brilliant work presents new developments and discoveries that have been made in the field. Parsing, also referred to as syntax analysis, has been and continues......一起来看看 《Parsing Techniques》 这本书的介绍吧!

Base64 编码/解码

Base64 编码/解码

Base64 编码/解码

UNIX 时间戳转换

UNIX 时间戳转换

UNIX 时间戳转换

HEX CMYK 转换工具

HEX CMYK 转换工具

HEX CMYK 互转工具