ZINCRBY key increment member
Increments the score of
member in the sorted set stored at
member does not exist in the sorted set, it is added with
increment as its score (as if its previous score was
key does not exist, a new sorted set with the specified
member as its sole member is created.
An error is returned when
key exists but does not hold a sorted set.
score value should be the string representation of a numeric value, and accepts double precision floating point numbers. It is possible to provide a negative value to decrement the score.
Bulk string reply: the new score of
member (a double precision floating point number), represented as string.
(integer) 1redis> ZADD myzset 2 "two"
(integer) 1redis> ZINCRBY myzset 2 "one"
"3"redis> ZRANGE myzset 0 -1 WITHSCORES
1) "two" 2) "2" 3) "one" 4) "3"
© 2009–2017 Salvatore Sanfilippo
Licensed under the Creative Commons Attribution-ShareAlike License 4.0.