ZADD key score member [[score member] [score member] ...]
One or more member elements and their score value is added to the ordered set key among.
If a member is already a member of an ordered set, then update the member 's score value, and by re-insertion of this member elements to ensure that the member in the correct position.
score value may be an integer or a double precision floating point value.
If the key does not exist, create an empty set and ordered to perform ZADD operation.
When the key but when there is not an ordered set type, returns an error.
More on ordered sets, refer sorted the SET .
SCARD key
Returns a collection of key cardinality (number of elements in the set).
ZCOUNT key min max
Returns the ordered set key in, score values min and max between (including default score value equal to min or max ) of the number of members.
About the parameters min and max detailed methods of use, please refer to ZRANGEBYSCORE command.
Is an ordered set of key members of the member 's score value plus incremental INCREMENT .
It can be a negative value by passing INCREMENT , so that score by subtracting the corresponding values, such as ZINCRBY Key -5 member , is to make the member of the score value minus 5 .
When the key is not present, or the member is not a key when a member, ZINCRBY key INCREMENT member equivalent to Zadd key INCREMENT member .
When the key when not ordered set type, returns an error.
score value may be an integer or a double precision floating point value.
ZRANGE key start stop [WITHSCORES]
Return ordered set key , specify members within range.
The position where the members of the press score value is incremented (small to large) to sort.
Have the same score members lexicographical ordering value ( the lexicographical Order ) are arranged.
If you want members of the press score value decrement (descending) to arrange, use ZREVRANGE command.
ZRANGEBYSCORE key min max [WITHSCORES] [LIMIT offset count]
Returns the ordered set key , all score values between min and max (including equal between the min or max ) members. Ordered set by a member of score value is incremented (small to large) arranged in the order.
It has the same score members lexicographical ordering value ( the lexicographical Order ) are arranged (the property is provided by an ordered set, no additional calculations).
The optional LIMIT parameter specifies the number of results returned and intervals (like SQL in the SELECT LIMIT offset, COUNT ), pay attention to when offset is large, positioning offset operations may need to traverse the entire ordered set, the complexity of this process is the worst It is O (N) time.
ZRANK key member
Returns an ordered set of key members member rankings. Wherein the ordered set by a member of score value is incremented (ascending) order.
Ranking to 0 as the bottom, that is to say, Score smallest member of the value of the ranking is 0 .
Use ZREVRANK command to get members of the press score value decrement (descending) arranged in the rankings.
ZREM key member [member ...]
Removal of an ordered set of key one or more members, there is no member will be ignored.
When the key but when there is not an ordered set type, returns an error.
ZREMRANGEBYRANK key start stop
Remove the ordered set key , all the members in the interval specified rank (rank).
The following intervals were marked parameters start and stop points out, contain start and stop account.
ZREMRANGEBYSCORE key min max
Removing ordered set key , all score values between min and max (including equal between the min or max ) members.
ZREVRANGE key start stop [WITHSCORES]
Return ordered set key , specify members within range.
In addition to members of the press score arranged for this point in descending order of value, ZREVRANGE other aspects and commands ZRANGE command.
- Available versions:
ZREVRANGEBYSCORE key max min [WITHSCORES] [LIMIT offset count]
Returns the ordered set key in, Score value between max and min between (including default equal to max or min ) of all members. Ordered set by a member of score values of decrement (descending) order of the arrangement.
It has the same score members value by reverse lexicographic order ( Reverse Order the lexicographical order).
In addition to members of the press score arranged for this point in descending order of value, ZREVRANGEBYSCORE other aspects and commands ZRANGEBYSCORE command.
ZREVRANK key member
Returns an ordered set of key members member rankings. Which ordered set by a member of score value decrement (descending) order.
Ranking to 0 as the bottom, that is to say, Score maximum value of the members ranked 0 .
Use ZRANK command to get members of the press score value is incremented (small to large) arranged in the rankings.
ZSCORE key member
Return ordered set key , a member of the member 's score value.
If the member element is not an ordered set of key members, or key does not exist, it returns nil .
ZUNIONSTORE destination numkeys key [key ...] [WEIGHTS weight [weight ...]] [AGGREGATE SUM|MIN|MAX]
Calculation given one or more ordered sets and sets, in which a given key number must numkeys specified parameters, and the union (the result set) stored Where do you want .
By default, a member of the result set score values are all members of a given set this score value and.
WEIGHTS
Use WEIGHTS option, you can specify a multiplication factor (multiplication factor) were each given an ordered set of all members of each given an ordered set score before the value is passed to an aggregate function (aggregation function) must first multiplied by the factor of the ordered set.
If no WEIGHTS option, the multiplication factor default setting is 1 .
AGGREGATE
Use AGGREGATE option, you can specify a set of aggregation and the result set.
Using the default parameters of the SUM , may be a member of all sets score value and the result set as the member score values; parameters MIN , the minimum can be a member of all sets score as the result of the focus member score values; and parameter MAX all collections sucked a member of the largest score value as a member of the result set score values.
ZINTERSTORE destination numkeys key [key ...] [WEIGHTS weight [weight ...]] [AGGREGATE SUM|MIN|MAX]
Computing the intersection of a given one or more ordered sets wherein the given key number must numkeys specified parameters, and the intersection (result set) stored Where do you want .
By default, a member of the result set score values are all members of a given set this score value and.
About WEIGHTS and AGGREGATE description of the options, see ZUNIONSTORE command.