Redis Zincrby command
Redis ordered set (sorted set)
Redis Zincrby command specifies the members of the ordered set of scores plus increment increment
You can pass through a negative value increment, so that score by subtracting the corresponding values, such ZINCRBY key -5 member, is to make the score value member minus 5.
When the key is not the key points of the member does not exist, or when, ZINCRBY key increment member is equivalent to ZADD key increment member.
When the key is not an ordered set type, an error is returned.
Score values can be integer or double-precision floating-point number.
grammar
redis Zincrby basic command syntax is as follows:
redis 127.0.0.1:6379> ZINCRBY key increment member
Available versions
> = 1.2.0
return value
The new members of the fractional member, as a string.
Examples
redis 127.0.0.1:6379> ZADD myzset 1 "hello" (integer) 1 redis 127.0.0.1:6379> ZADD myzset 1 "foo" (integer) 1 redis 127.0.0.1:6379> ZINCRBY myzset 2 "hello" (integer) 3 redis 127.0.0.1:6379> ZRANGE myzset 0 -1 WITHSCORES 1) "foo" 2) "2" 3) "hello" 4) "3"