ZINCRBY

Syntax
ZINCRBY key increment member
Available since:
1.2.0
Time complexity:
O(log(N)) where N is the number of elements in the sorted set.
ACL categories:
@write, @sortedset, @fast,

将存储在key中的有序集合中的member的分数增加increment。 如果member在有序集合中不存在,则将其添加,并将increment作为其分数(就像其之前的分数是0.0)。 如果key不存在,则创建一个新的有序集合,并将指定的member作为其唯一成员。

key存在但不持有排序集合时,将返回错误。

score 值应为数值的字符串表示形式,并且接受双精度浮点数。可以提供负值来减少分数。

示例

ZADD myzset 1 "one" ZADD myzset 2 "two" ZINCRBY myzset 2 "one" ZRANGE myzset 0 -1 WITHSCORES

RESP2 回复

Bulk string reply: the new score of member as a double precision floating point number.

RESP3 回复

Double reply: the new score of member.
RATE THIS PAGE
Back to top ↑