Adds one or more members to a sorted set, or update its score if it already exists.
Adds one or more members to a sorted set, or update its score if it already exists.
sorted set key
member-score pairs to be added
the number of elements added to the sorted sets, not including elements already existing for which the score was updated
2.4
if key contains a value that is not a sorted set
If a specified member is already a member of the sorted set, the score is updated and the element reinserted at the right position to ensure the correct ordering.
Adds a member to a sorted set, or update its score if it already exists.
Adds a member to a sorted set, or update its score if it already exists.
sorted set key
member to add
score of the member to add
true if the member was added, or false if the member already exists
1.2.0
if key contains a value that is not a sorted set
If a specified member is already a member of the sorted set, the score is updated and the element reinserted at the right position to ensure the correct ordering.
Returns the number of members in a sorted set.
Returns the number of members in a sorted set.
sorted set key
the cardinality (number of elements) of the sorted set, or 0 if key does not exist
1.2.0
if key contains a value that is not a sorted set
Returns the number of elements of a sorted set belonging to a given score range.
Returns the number of elements of a sorted set belonging to a given score range.
sorted set key
score lower bound
score upper bound
the number of elements in the specified score range
2.0.0
if key contains a value that is not a sorted set
Increments the score of a member in a sorted set.
Increments the score of a member in a sorted set.
sorted set key
member whose score needs to be incremented
the increment
the new score of member
1.2.0
if key contains a value that is not a sorted set
Intersects multiple sorted sets and stores the resulting sorted set in a new key.
Intersects multiple sorted sets and stores the resulting sorted set in a new key.
sorted set key
keys of sorted sets to intersect
aggregation function (default is Sum)
the number of elements in the resulting sorted set stored at destKey
2.0.0
if key contains a value that is not a sorted set
Intersects multiple sorted sets and stores the resulting sorted set in a new key.
Intersects multiple sorted sets and stores the resulting sorted set in a new key.
sorted set key
key to weight pairs
aggregation function (default is Sum)
the number of elements in the resulting sorted set stored at destKey
2.0.0
if key contains a value that is not a sorted set
Returns the number of elements of a sorted set belonging to a given lexical score range.
Returns the number of elements of a sorted set belonging to a given lexical score range.
sorted set key
lexical score lower bound
lexical score upper bound
the number of elements in the specified lexical score range
2.8.9
if key contains a value that is not a sorted set
Lexical ordering only applies when all the elements in a sorted set are inserted with the same score
Returns a range of members in a sorted set, by index.
Returns a range of members in a sorted set, by index.
sorted set key
start offset (inclusive)
stop offset (inclusive)
the set of ascendingly ordered elements in the specified range, or the empty set if key does not exist
1.2.0
if key contains a value that is not a sorted set
Both start and stop are zero-based indexes, where 0 is the first element, 1 is the next
element and so on. They can also be negative numbers indicating offsets from the end of the
sorted set, with -1 being the last element of the sorted set, -2 the penultimate element and
so on. Out of range indexes will not produce an error. If start is larger than the largest
index in the sorted set, or start
> end
, an empty list is returned. If end
is larger
than the end of the sorted set Redis will treat it like it is the last element of the
sorted set. The indexes are inclusive.
Returns a range of members in a sorted set, by lexical score.
Returns a range of members in a sorted set, by lexical score.
sorted set key
lexical score lower bound
lexical score upper bound
optional offset and count pair used to limit the number of matching elements
the set of ascendingly ordered elements in the specified lexical range, or the empty set if key does not exist
2.8.9
if key contains a value that is not a sorted set
Lexical ordering only applies when all the elements in a sorted set are inserted with the same score
Returns a range of members in a sorted set, by score.
Returns a range of members in a sorted set, by score.
sorted set key
score lower bound
score upper bound
optional offset and count pair used to limit the number of matching elements
the set of ascendingly ordered elements in the specified score range, or the empty set if key does not exist
2.2.0
if key contains a value that is not a sorted set
The elements having the same score are returned in lexicographical order (this follows from a property of the sorted set implementation in Redis and does not involve further computation).
Returns a range of members with associated scores in a sorted set, by score.
Returns a range of members with associated scores in a sorted set, by score.
sorted set key
score lower bound
score upper bound
optional offset and count pair used to limit the number of matching elements
the set of ascendingly ordered element-score pairs in the specified score range, or the empty set if key does not exist
2.0.0
if key contains a value that is not a sorted set
The elements having the same score are returned in lexicographical order (this follows from a property of the sorted set implementation in Redis and does not involve further computation).
Returns a range of members with associated scores in a sorted set, by index.
Returns a range of members with associated scores in a sorted set, by index.
sorted set key
start offset (inclusive)
end offset (inclusive)
the set of ascendingly ordered elements-score pairs in the specified range, or the empty set if key does not exist
1.2.0
if key contains a value that is not a sorted set
Both start and stop are zero-based indexes, where 0 is the first element, 1 is the next
element and so on. They can also be negative numbers indicating offsets from the end of the
sorted set, with -1 being the last element of the sorted set, -2 the penultimate element and
so on. Out of range indexes will not produce an error. If start is larger than the largest
index in the sorted set, or start
> end
, an empty list is returned. If end
is larger
than the end of the sorted set Redis will treat it like it is the last element of the
sorted set. The indexes are inclusive.
Determines the index of a member in a sorted set.
Determines the index of a member in a sorted set.
sorted set key
the value
the rank or index of the member, or None
if the member is not in the set or the key
does not exist
2.0.0
if key contains a value that is not a sorted set
Removes one or more members from a sorted set.
Removes one or more members from a sorted set.
sorted set key
additional values to be removed (only works with Redis >= 2.4)
the number of members removed from the sorted set, not including non existing members
2.0.0
if key contains a value that is not a sorted set
Redis versions older than 2.4 can only remove one value per call.
Removes all members in a sorted set within the given lexical range.
Removes all members in a sorted set within the given lexical range.
sorted set key
lexical score lower bound
lexical score upper bound
the number of removed elements
2.8.9
if key contains a value that is not a sorted set
Lexical ordering only applies when all the elements in a sorted set are inserted with the same score
Removes all members in a sorted set within the given indexes.
Removes all members in a sorted set within the given indexes.
sorted set key
the start offset or index (inclusive)
the stop offset or index (inclusive)
the number of members removed
2.0.0
if key contains a value that is not a sorted set
Both start and stop are zero-based inclusive indexes with 0 being the element with the lowest score. These indexes can be negative numbers, where they indicate offsets starting at the element with the highest score. For example: -1 is the element with the highest score, -2 the element with the second highest score and so forth.
Removes all members in a sorted set within the given scores range.
Removes all members in a sorted set within the given scores range.
sorted set key
score lower bound
score upper bound
the number of members removed
1.2.0
if key contains a value that is not a sorted set
Since version 2.1.6, min and max can be exclusive, following the syntax of ZRANGEBYSCORE.
Returns a range of members in a sorted set, by index, with scores ordered from high to low.
Returns a range of members in a sorted set, by index, with scores ordered from high to low.
sorted set key
start offset (inclusive)
stop offset (inclusive)
the set of descendingly ordered elements in the specified range, or the empty set if key does not exist
1.2.0
if key contains a value that is not a sorted set
Apart from the reversed ordering, ZREVRANGE is similar to ZRANGE.
Returns a range of members in a sorted set, by score, with scores ordered from high to low.
Returns a range of members in a sorted set, by score, with scores ordered from high to low.
sorted set key
score upper bound
score lower bound
optional offset and count pair used to limit the number of matching elements
the set of descendingly ordered elements in the specified score range, or the empty set if key does not exist
2.2.0
if key contains a value that is not a sorted set
Apart from the reversed ordering, ZREVRANGEBYSCORE is similar to ZRANGEBYSCORE. The elements having the same score are returned in reverse lexicographical order.
Return a range of members with associated scores in a sorted set, by score, with scores ordered from high to low.
Return a range of members with associated scores in a sorted set, by score, with scores ordered from high to low.
sorted set key
score upper bound
score lower bound
optional offset and count pair used to limit the number of matching elements
the set of descendingly ordered elements in the specified score range, or the empty set if key does not exist
2.2.0
if key contains a value that is not a sorted set
Apart from the reversed ordering, ZREVRANGEBYSCORE is similar to ZRANGEBYSCORE. The elements having the same score are returned in reverse lexicographical order.
Returns a range of members in a sorted set, by index, with scores ordered from high to low.
Returns a range of members in a sorted set, by index, with scores ordered from high to low.
sorted set key
start offset (inclusive)
stop offset (inclusive)
the set of descendingly ordered elements-score pairs in the specified range, or the empty set if key does not exist
1.2.0
if key contains a value that is not a sorted set
Apart from the reversed ordering, ZREVRANGE is similar to ZRANGE. The elements having the same score are returned in reverse lexicographical order.
Determine the index of a member in a sorted set, with scores ordered from high to low.
Determine the index of a member in a sorted set, with scores ordered from high to low.
sorted set key
the value
the rank or index of the member, or None
if the member is not in the set or the key
does not exist
2.0.0
if key contains a value that is not a sorted set
Incrementally iterates the elements (value-score pairs) of a sorted set.
Incrementally iterates the elements (value-score pairs) of a sorted set.
the offset
when defined, the command only returns elements matching the pattern
when defined, provides a hint of how many elements should be returned
a pair containing the next cursor as its first element and the sorted set of elements (value-score pairs) as its second element
2.8.0
Returns the score associated with the given member in a sorted set.
Returns the score associated with the given member in a sorted set.
sorted set key
the value
the score of member, or None
if the latter is not in the sorted set or the key does
not exist
1.2.0
if key contains a value that is not a sorted set
Computes the union of multiple sorted sets and stores the resulting sorted set in a new key.
Computes the union of multiple sorted sets and stores the resulting sorted set in a new key.
sorted set key
keys of sorted sets
aggregation function (default is Sum)
the number of elements in the resulting sorted set stored at destKey
2.0.0
if key contains a value that is not a sorted set
Computes the union of multiple sorted sets and stores the resulting sorted set in a new key.
Computes the union of multiple sorted sets and stores the resulting sorted set in a new key.
sorted set key
aggregation function (default is Sum)
the number of elements in the resulting sorted set stored at destKey
2.0.0
if key contains a value that is not a sorted set
This trait implements sorted set commands.