Redis Zincrby Command
The Redis Zincrby command adds the increment to the score of the specified member in the sorted set
You can pass a negative increment value to subtract the corresponding value from the score; for example, ZINCRBY key -5 member subtracts 5 from the member's score.
When key does not exist, or the member is not a member of key, ZINCRBY key increment member is equivalent to ZADD key increment member.
Returns an error when key is not of sorted set type.
The score value can be an integer or a double-precision floating-point number.
Syntax
The basic syntax of the redis Zincrby command is as follows:
redis 127.0.0.1:6379> ZINCRBY key increment member
Available Version
= 1.2.0
Return Value
The new score value of the member, represented as a string.
Example
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>
