trait SortedSetCommands extends AnyRef
This trait implements sorted set commands.
- Self Type
- SortedSetCommands with Connection with NonBlockingConnection
- Alphabetic
- By Inheritance
- SortedSetCommands
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##(): Int
- Definition Classes
- AnyRef → Any
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def clone(): AnyRef
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native()
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- def finalize(): Unit
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable])
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def toString(): String
- Definition Classes
- AnyRef → Any
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()
- def zAdd[W](key: String, members: Map[W, Score])(implicit arg0: Writer[W]): Future[Long]
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.
- key
sorted set key
- members
member-score pairs to be added
- returns
the number of elements added to the sorted sets, not including elements already existing for which the score was updated
- Since
2.4
- Exceptions thrown
[[scredis.exceptions.RedisErrorResponseException]]
if key contains a value that is not a sorted set- Note
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.
- def zAdd[W](key: String, member: W, score: Score)(implicit arg0: Writer[W]): Future[Boolean]
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.
- key
sorted set key
- member
member to add
- score
score of the member to add
- returns
true if the member was added, or false if the member already exists
- Since
1.2.0
- Exceptions thrown
[[scredis.exceptions.RedisErrorResponseException]]
if key contains a value that is not a sorted set- Note
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.
- def zCard(key: String): Future[Long]
Returns the number of members in a sorted set.
Returns the number of members in a sorted set.
- key
sorted set key
- returns
the cardinality (number of elements) of the sorted set, or 0 if key does not exist
- Since
1.2.0
- Exceptions thrown
[[scredis.exceptions.RedisErrorResponseException]]
if key contains a value that is not a sorted set
- def zCount(key: String, min: ScoreLimit, max: ScoreLimit): Future[Long]
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.
- key
sorted set key
- min
score lower bound
- max
score upper bound
- returns
the number of elements in the specified score range
- Since
2.0.0
- Exceptions thrown
[[scredis.exceptions.RedisErrorResponseException]]
if key contains a value that is not a sorted set
- def zIncrBy[W](key: String, member: W, increment: Double)(implicit arg0: Writer[W]): Future[Double]
Increments the score of a member in a sorted set.
Increments the score of a member in a sorted set.
- key
sorted set key
- member
member whose score needs to be incremented
- increment
the increment
- returns
the new score of member
- Since
1.2.0
- Exceptions thrown
[[scredis.exceptions.RedisErrorResponseException]]
if key contains a value that is not a sorted set
- def zInterStore(destKey: String, keys: Seq[String], aggregate: Aggregate = scredis.Aggregate.Sum): Future[Long]
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.
- destKey
sorted set key
- keys
keys of sorted sets to intersect
- aggregate
aggregation function (default is Sum)
- returns
the number of elements in the resulting sorted set stored at destKey
- Since
2.0.0
- Exceptions thrown
[[scredis.exceptions.RedisErrorResponseException]]
if key contains a value that is not a sorted set
- def zInterStoreWeighted(destKey: String, keysWeightPairs: Map[String, Double], aggregate: Aggregate = scredis.Aggregate.Sum): Future[Long]
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.
- destKey
sorted set key
- keysWeightPairs
key to weight pairs
- aggregate
aggregation function (default is Sum)
- returns
the number of elements in the resulting sorted set stored at destKey
- Since
2.0.0
- Exceptions thrown
[[scredis.exceptions.RedisErrorResponseException]]
if key contains a value that is not a sorted set
- def zLexCount(key: String, min: LexicalScoreLimit, max: LexicalScoreLimit): Future[Long]
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.
- key
sorted set key
- min
lexical score lower bound
- max
lexical score upper bound
- returns
the number of elements in the specified lexical score range
- Since
2.8.9
- Exceptions thrown
[[scredis.exceptions.RedisErrorResponseException]]
if key contains a value that is not a sorted set- Note
Lexical ordering only applies when all the elements in a sorted set are inserted with the same score
- def zRange[R](key: String, start: Long = 0, stop: Long = -1)(implicit arg0: Reader[R]): Future[LinkedHashSet[R]]
Returns a range of members in a sorted set, by index.
Returns a range of members in a sorted set, by index.
- key
sorted set key
- start
start offset (inclusive)
- stop
stop offset (inclusive)
- returns
the set of ascendingly ordered elements in the specified range, or the empty set if key does not exist
- Since
1.2.0
- Exceptions thrown
[[scredis.exceptions.RedisErrorResponseException]]
if key contains a value that is not a sorted set- Note
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. Ifend
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.
- def zRangeByLex[R](key: String, min: LexicalScoreLimit, max: LexicalScoreLimit, limitOpt: Option[(Long, Int)] = None)(implicit arg0: Reader[R]): Future[LinkedHashSet[R]]
Returns a range of members in a sorted set, by lexical score.
Returns a range of members in a sorted set, by lexical score.
- key
sorted set key
- min
lexical score lower bound
- max
lexical score upper bound
- limitOpt
optional offset and count pair used to limit the number of matching elements
- returns
the set of ascendingly ordered elements in the specified lexical range, or the empty set if key does not exist
- Since
2.8.9
- Exceptions thrown
[[scredis.exceptions.RedisErrorResponseException]]
if key contains a value that is not a sorted set- Note
Lexical ordering only applies when all the elements in a sorted set are inserted with the same score
- def zRangeByScore[R](key: String, min: ScoreLimit, max: ScoreLimit, limitOpt: Option[(Long, Int)] = None)(implicit arg0: Reader[R]): Future[LinkedHashSet[R]]
Returns a range of members in a sorted set, by score.
Returns a range of members in a sorted set, by score.
- key
sorted set key
- min
score lower bound
- max
score upper bound
- limitOpt
optional offset and count pair used to limit the number of matching elements
- returns
the set of ascendingly ordered elements in the specified score range, or the empty set if key does not exist
- Since
2.2.0
- Exceptions thrown
[[scredis.exceptions.RedisErrorResponseException]]
if key contains a value that is not a sorted set- Note
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).
- def zRangeByScoreWithScores[R](key: String, min: ScoreLimit, max: ScoreLimit, limitOpt: Option[(Long, Int)] = None)(implicit arg0: Reader[R]): Future[LinkedHashSet[(R, Score)]]
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.
- key
sorted set key
- min
score lower bound
- max
score upper bound
- limitOpt
optional offset and count pair used to limit the number of matching elements
- returns
the set of ascendingly ordered element-score pairs in the specified score range, or the empty set if key does not exist
- Since
2.0.0
- Exceptions thrown
[[scredis.exceptions.RedisErrorResponseException]]
if key contains a value that is not a sorted set- Note
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).
- def zRangeWithScores[R](key: String, start: Long = 0, stop: Long = -1)(implicit arg0: Reader[R]): Future[LinkedHashSet[(R, Score)]]
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.
- key
sorted set key
- start
start offset (inclusive)
- stop
end offset (inclusive)
- returns
the set of ascendingly ordered elements-score pairs in the specified range, or the empty set if key does not exist
- Since
1.2.0
- Exceptions thrown
[[scredis.exceptions.RedisErrorResponseException]]
if key contains a value that is not a sorted set- Note
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. Ifend
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.
- def zRank[W](key: String, member: W)(implicit arg0: Writer[W]): Future[Option[Long]]
Determines the index of a member in a sorted set.
Determines the index of a member in a sorted set.
- key
sorted set key
- member
the value
- returns
the rank or index of the member, or
None
if the member is not in the set or the key does not exist
- Since
2.0.0
- Exceptions thrown
[[scredis.exceptions.RedisErrorResponseException]]
if key contains a value that is not a sorted set
- def zRem[W](key: String, members: W*)(implicit arg0: Writer[W]): Future[Long]
Removes one or more members from a sorted set.
Removes one or more members from a sorted set.
- key
sorted set key
- members
additional values to be removed (only works with Redis >= 2.4)
- returns
the number of members removed from the sorted set, not including non existing members
- Since
2.0.0
- Exceptions thrown
[[scredis.exceptions.RedisErrorResponseException]]
if key contains a value that is not a sorted set- Note
Redis versions older than 2.4 can only remove one value per call.
- def zRemRangeByLex(key: String, min: LexicalScoreLimit, max: LexicalScoreLimit): Future[Long]
Removes all members in a sorted set within the given lexical range.
Removes all members in a sorted set within the given lexical range.
- key
sorted set key
- min
lexical score lower bound
- max
lexical score upper bound
- returns
the number of removed elements
- Since
2.8.9
- Exceptions thrown
[[scredis.exceptions.RedisErrorResponseException]]
if key contains a value that is not a sorted set- Note
Lexical ordering only applies when all the elements in a sorted set are inserted with the same score
- def zRemRangeByRank(key: String, start: Long, stop: Long): Future[Long]
Removes all members in a sorted set within the given indexes.
Removes all members in a sorted set within the given indexes.
- key
sorted set key
- start
the start offset or index (inclusive)
- stop
the stop offset or index (inclusive)
- returns
the number of members removed
- Since
2.0.0
- Exceptions thrown
[[scredis.exceptions.RedisErrorResponseException]]
if key contains a value that is not a sorted set- Note
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.
- def zRemRangeByScore(key: String, min: ScoreLimit, max: ScoreLimit): Future[Long]
Removes all members in a sorted set within the given scores range.
Removes all members in a sorted set within the given scores range.
- key
sorted set key
- min
score lower bound
- max
score upper bound
- returns
the number of members removed
- Since
1.2.0
- Exceptions thrown
[[scredis.exceptions.RedisErrorResponseException]]
if key contains a value that is not a sorted set- Note
Since version 2.1.6, min and max can be exclusive, following the syntax of ZRANGEBYSCORE.
- def zRevRange[R](key: String, start: Long = 0, stop: Long = -1)(implicit arg0: Reader[R]): Future[LinkedHashSet[R]]
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.
- key
sorted set key
- start
start offset (inclusive)
- stop
stop offset (inclusive)
- returns
the set of descendingly ordered elements in the specified range, or the empty set if key does not exist
- Since
1.2.0
- Exceptions thrown
[[scredis.exceptions.RedisErrorResponseException]]
if key contains a value that is not a sorted set- Note
Apart from the reversed ordering, ZREVRANGE is similar to ZRANGE.
- def zRevRangeByScore[R](key: String, max: ScoreLimit, min: ScoreLimit, limitOpt: Option[(Long, Int)] = None)(implicit arg0: Reader[R]): Future[LinkedHashSet[R]]
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.
- key
sorted set key
- max
score upper bound
- min
score lower bound
- limitOpt
optional offset and count pair used to limit the number of matching elements
- returns
the set of descendingly ordered elements in the specified score range, or the empty set if key does not exist
- Since
2.2.0
- Exceptions thrown
[[scredis.exceptions.RedisErrorResponseException]]
if key contains a value that is not a sorted set- Note
Apart from the reversed ordering, ZREVRANGEBYSCORE is similar to ZRANGEBYSCORE. The elements having the same score are returned in reverse lexicographical order.
- def zRevRangeByScoreWithScores[R](key: String, max: ScoreLimit, min: ScoreLimit, limitOpt: Option[(Long, Int)] = None)(implicit arg0: Reader[R]): Future[LinkedHashSet[(R, Score)]]
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.
- key
sorted set key
- max
score upper bound
- min
score lower bound
- limitOpt
optional offset and count pair used to limit the number of matching elements
- returns
the set of descendingly ordered elements in the specified score range, or the empty set if key does not exist
- Since
2.2.0
- Exceptions thrown
[[scredis.exceptions.RedisErrorResponseException]]
if key contains a value that is not a sorted set- Note
Apart from the reversed ordering, ZREVRANGEBYSCORE is similar to ZRANGEBYSCORE. The elements having the same score are returned in reverse lexicographical order.
- def zRevRangeWithScores[R](key: String, start: Long = 0, stop: Long = -1)(implicit arg0: Reader[R]): Future[LinkedHashSet[(R, Score)]]
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.
- key
sorted set key
- start
start offset (inclusive)
- stop
stop offset (inclusive)
- returns
the set of descendingly ordered elements-score pairs in the specified range, or the empty set if key does not exist
- Since
1.2.0
- Exceptions thrown
[[scredis.exceptions.RedisErrorResponseException]]
if key contains a value that is not a sorted set- Note
Apart from the reversed ordering, ZREVRANGE is similar to ZRANGE. The elements having the same score are returned in reverse lexicographical order.
- def zRevRank[W](key: String, member: W)(implicit arg0: Writer[W]): Future[Option[Long]]
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.
- key
sorted set key
- member
the value
- returns
the rank or index of the member, or
None
if the member is not in the set or the key does not exist
- Since
2.0.0
- Exceptions thrown
[[scredis.exceptions.RedisErrorResponseException]]
if key contains a value that is not a sorted set
- def zScan[R](key: String, cursor: Long, matchOpt: Option[String] = None, countOpt: Option[Int] = None)(implicit arg0: Reader[R]): Future[(Long, LinkedHashSet[(R, Score)])]
Incrementally iterates the elements (value-score pairs) of a sorted set.
Incrementally iterates the elements (value-score pairs) of a sorted set.
- cursor
the offset
- matchOpt
when defined, the command only returns elements matching the pattern
- countOpt
when defined, provides a hint of how many elements should be returned
- returns
a pair containing the next cursor as its first element and the sorted set of elements (value-score pairs) as its second element
- Since
2.8.0
- def zScore[W](key: String, member: W)(implicit arg0: Writer[W]): Future[Option[Score]]
Returns the score associated with the given member in a sorted set.
Returns the score associated with the given member in a sorted set.
- key
sorted set key
- member
the value
- returns
the score of member, or
None
if the latter is not in the sorted set or the key does not exist
- Since
1.2.0
- Exceptions thrown
[[scredis.exceptions.RedisErrorResponseException]]
if key contains a value that is not a sorted set
- def zUnionStore(destKey: String, keys: Seq[String], aggregate: Aggregate = scredis.Aggregate.Sum): Future[Long]
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.
- destKey
sorted set key
- keys
keys of sorted sets
- aggregate
aggregation function (default is Sum)
- returns
the number of elements in the resulting sorted set stored at destKey
- Since
2.0.0
- Exceptions thrown
[[scredis.exceptions.RedisErrorResponseException]]
if key contains a value that is not a sorted set
- def zUnionStoreWeighted(destKey: String, keysWeightPairs: Map[String, Double], aggregate: Aggregate = scredis.Aggregate.Sum): Future[Long]
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.
- destKey
sorted set key
- keysWeightPairs
key to weight pairs
- aggregate
aggregation function (default is Sum)
- returns
the number of elements in the resulting sorted set stored at destKey
- Since
2.0.0
- Exceptions thrown
[[scredis.exceptions.RedisErrorResponseException]]
if key contains a value that is not a sorted set