Interface ZSetOperations<K,V>
public interface ZSetOperations<K,V>
Redis ZSet/sorted set specific operations.
- Author:
- Costin Leau, Christoph Strobl, Mark Paluch, Rosty Kerei, Wongoo (望哥), Andrey Shlykov, Shyngys Sapraliyev
-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic interface
Typed ZSet tuple. -
Method Summary
Modifier and TypeMethodDescriptionadd
(K key, Set<ZSetOperations.TypedTuple<V>> tuples) Addtuples
to a sorted set atkey
, or update itsscore
if it already exists.Addvalue
to a sorted set atkey
, or update itsscore
if it already exists.addIfAbsent
(K key, Set<ZSetOperations.TypedTuple<V>> tuples) Addtuples
to a sorted set atkey
if it does not already exists.addIfAbsent
(K key, V value, double score) Addvalue
to a sorted set atkey
if it does not already exists.Count number of elements within sorted set with scores betweenmin
andmax
.difference
(K key, Collection<K> otherKeys) Diff sortedsets
.difference
(K key, K otherKey) Diff sortedsets
.differenceAndStore
(K key, Collection<K> otherKeys, K destKey) Diff sortedsets
and store result in destinationdestKey
.differenceWithScores
(K key, Collection<K> otherKeys) Diff sortedsets
.default Set<ZSetOperations.TypedTuple<V>>
differenceWithScores
(K key, K otherKey) Diff sortedsets
.distinctRandomMembers
(K key, long count) Getcount
distinct random elements from set atkey
.distinctRandomMembersWithScore
(K key, long count) Getcount
distinct random elements with their score from set atkey
.incrementScore
(K key, V value, double delta) Increment the score of element withvalue
in sorted set byincrement
.intersect
(K key, Collection<K> otherKeys) Intersect sortedsets
.Intersect sortedsets
.intersectAndStore
(K key, Collection<K> otherKeys, K destKey) Intersect sorted sets atkey
andotherKeys
and store result in destinationdestKey
.default Long
intersectAndStore
(K key, Collection<K> otherKeys, K destKey, Aggregate aggregate) Intersect sorted sets atkey
andotherKeys
and store result in destinationdestKey
.intersectAndStore
(K key, Collection<K> otherKeys, K destKey, Aggregate aggregate, Weights weights) Intersect sorted sets atkey
andotherKeys
and store result in destinationdestKey
.intersectAndStore
(K key, K otherKey, K destKey) Intersect sorted sets atkey
andotherKey
and store result in destinationdestKey
.intersectWithScores
(K key, Collection<K> otherKeys) Intersect sortedsets
.default Set<ZSetOperations.TypedTuple<V>>
intersectWithScores
(K key, Collection<K> otherKeys, Aggregate aggregate) Intersect sorted sets atkey
andotherKeys
.intersectWithScores
(K key, Collection<K> otherKeys, Aggregate aggregate, Weights weights) Intersect sortedsets
.default Set<ZSetOperations.TypedTuple<V>>
intersectWithScores
(K key, K otherKey) Intersect sortedsets
.Count number of elements within sorted set with value betweenRange.getLowerBound()
andRange.getUpperBound()
applying lexicographical ordering.default Long
lexCount
(K key, RedisZSetCommands.Range range) Deprecated, for removal: This API element is subject to removal in a future version.since 3.0.Remove and return the value with its score having the highest score from sorted set atkey
.Remove and returncount
values with their score having the highest score from sorted set atkey
.Remove and return the value with its score having the highest score from sorted set atkey
.default ZSetOperations.TypedTuple<V>
Remove and return the value with its score having the highest score from sorted set atkey
.Remove and return the value with its score having the lowest score from sorted set atkey
.Remove and returncount
values with their score having the lowest score from sorted set atkey
.Remove and return the value with its score having the lowest score from sorted set atkey
.default ZSetOperations.TypedTuple<V>
Remove and return the value with its score having the lowest score from sorted set atkey
.randomMember
(K key) Get random element from set atkey
.randomMembers
(K key, long count) Getcount
random elements from set atkey
.randomMembersWithScore
(K key, long count) Getcount
random elements with their score from set atkey
.randomMemberWithScore
(K key) Get random element with its score from set atkey
.Get elements betweenstart
andend
from sorted set.default Long
rangeAndStoreByLex
(K srcKey, K dstKey, Range<String> range) Store all elements atdstKey
with lexicographical ordering from ZSET atsrcKey
with a value betweenRange.getLowerBound()
andRange.getUpperBound()
.Store n elements atdstKey
, where n =Limit.getCount()
, starting atLimit.getOffset()
with lexicographical ordering from ZSET atsrcKey
with a value betweenRange.getLowerBound()
andRange.getUpperBound()
.default Long
rangeAndStoreByScore
(K srcKey, K dstKey, Range<? extends Number> range) Store all elements atdstKey
with ordering by score from ZSET atsrcKey
with a score betweenRange.getLowerBound()
andRange.getUpperBound()
.Store n elements atdstKey
, where n =Limit.getCount()
, starting atLimit.getOffset()
with ordering by score from ZSET atsrcKey
with a score betweenRange.getLowerBound()
andRange.getUpperBound()
.rangeByLex
(K key, Range<String> range) Get all elements with lexicographical ordering from ZSET atkey
with a value betweenRange.getLowerBound()
andRange.getUpperBound()
.rangeByLex
(K key, Range<String> range, Limit limit) Get all elements n elements, where n =Limit.getCount()
, starting atLimit.getOffset()
with lexicographical ordering from ZSET atkey
with a value betweenRange.getLowerBound()
andRange.getUpperBound()
.rangeByLex
(K key, RedisZSetCommands.Range range) Deprecated, for removal: This API element is subject to removal in a future version.since 3.0.rangeByLex
(K key, RedisZSetCommands.Range range, Limit limit) Deprecated, for removal: This API element is subject to removal in a future version.since 3.0.rangeByScore
(K key, double min, double max) Get elements where score is betweenmin
andmax
from sorted set.rangeByScore
(K key, double min, double max, long offset, long count) Get elements in range fromstart
toend
where score is betweenmin
andmax
from sorted set.rangeByScoreWithScores
(K key, double min, double max) rangeByScoreWithScores
(K key, double min, double max, long offset, long count) rangeWithScores
(K key, long start, long end) Determine the index of element withvalue
in a sorted set.Removevalues
from sorted set.removeRange
(K key, long start, long end) Remove elements in range betweenstart
andend
from sorted set withkey
.removeRangeByLex
(K key, Range<String> range) Remove elements inRange
from sorted set with key.default Long
removeRangeByLex
(K key, RedisZSetCommands.Range range) Deprecated, for removal: This API element is subject to removal in a future version.since 3.0.removeRangeByScore
(K key, double min, double max) Remove elements with scores betweenmin
andmax
from sorted set withkey
.reverseRange
(K key, long start, long end) Get elements in range fromstart
toend
from sorted set ordered from high to low.default Long
reverseRangeAndStoreByLex
(K srcKey, K dstKey, Range<String> range) Store all elements atdstKey
with reverse lexicographical ordering from ZSET atsrcKey
with a value betweenRange.getLowerBound()
andRange.getUpperBound()
.Store n elements atdstKey
, where n =Limit.getCount()
, starting atLimit.getOffset()
with reverse lexicographical ordering from ZSET atsrcKey
with a value betweenRange.getLowerBound()
andRange.getUpperBound()
.default Long
reverseRangeAndStoreByScore
(K srcKey, K dstKey, Range<? extends Number> range) Store all elements atdstKey
with reverse ordering by score from ZSET atsrcKey
with a score betweenRange.getLowerBound()
andRange.getUpperBound()
.Store n elements atdstKey
, where n =Limit.getCount()
, starting atLimit.getOffset()
with reverse ordering by score from ZSET atsrcKey
with a score betweenRange.getLowerBound()
andRange.getUpperBound()
.reverseRangeByLex
(K key, Range<String> range) Get all elements with reverse lexicographical ordering from ZSET atkey
with a value betweenRange.getLowerBound()
andRange.getUpperBound()
.reverseRangeByLex
(K key, Range<String> range, Limit limit) Get all elements n elements, where n =Limit.getCount()
, starting atLimit.getOffset()
with reverse lexicographical ordering from ZSET atkey
with a value betweenRange.getLowerBound()
andRange.getUpperBound()
.reverseRangeByLex
(K key, RedisZSetCommands.Range range) Deprecated, for removal: This API element is subject to removal in a future version.since 3.0.reverseRangeByLex
(K key, RedisZSetCommands.Range range, Limit limit) Deprecated, for removal: This API element is subject to removal in a future version.since 3.0.reverseRangeByScore
(K key, double min, double max) Get elements where score is betweenmin
andmax
from sorted set ordered from high to low.reverseRangeByScore
(K key, double min, double max, long offset, long count) Get elements in range fromstart
toend
where score is betweenmin
andmax
from sorted set ordered high -> low.reverseRangeByScoreWithScores
(K key, double min, double max) reverseRangeByScoreWithScores
(K key, double min, double max, long offset, long count) Get set ofTuple
in range fromstart
toend
where score is betweenmin
andmax
from sorted set ordered high -> low.reverseRangeWithScores
(K key, long start, long end) reverseRank
(K key, Object o) Determine the index of element withvalue
in a sorted set when scored high to low.scan
(K key, ScanOptions options) Use aCursor
to iterate over entries zset atkey
.Get the score of element withvalue
from sorted set with keykey
.Get the scores of elements withvalues
from sorted set with keykey
.Returns the number of elements of the sorted set stored with givenkey
.union
(K key, Collection<K> otherKeys) Union sortedsets
.Union sortedsets
.unionAndStore
(K key, Collection<K> otherKeys, K destKey) Union sorted sets atkey
andotherKeys
and store result in destinationdestKey
.default Long
unionAndStore
(K key, Collection<K> otherKeys, K destKey, Aggregate aggregate) Union sorted sets atkey
andotherKeys
and store result in destinationdestKey
.unionAndStore
(K key, Collection<K> otherKeys, K destKey, Aggregate aggregate, Weights weights) Union sorted sets atkey
andotherKeys
and store result in destinationdestKey
.unionAndStore
(K key, K otherKey, K destKey) Union sorted sets atkey
andotherKeys
and store result in destinationdestKey
.unionWithScores
(K key, Collection<K> otherKeys) Union sortedsets
.default Set<ZSetOperations.TypedTuple<V>>
unionWithScores
(K key, Collection<K> otherKeys, Aggregate aggregate) Union sorted sets atkey
andotherKeys
.unionWithScores
(K key, Collection<K> otherKeys, Aggregate aggregate, Weights weights) Union sortedsets
.default Set<ZSetOperations.TypedTuple<V>>
unionWithScores
(K key, K otherKey) Union sortedsets
.Get the size of sorted set withkey
.
-
Method Details
-
add
Addvalue
to a sorted set atkey
, or update itsscore
if it already exists.- Parameters:
key
- must not be null.value
- the value.score
- the score.- Returns:
- null when used in pipeline / transaction.
- See Also:
-
addIfAbsent
Addvalue
to a sorted set atkey
if it does not already exists.- Parameters:
key
- must not be null.value
- the value.score
- the score.- Returns:
- null when used in pipeline / transaction.
- Since:
- 2.5
- See Also:
-
add
Addtuples
to a sorted set atkey
, or update itsscore
if it already exists.- Parameters:
key
- must not be null.tuples
- must not be null.- Returns:
- null when used in pipeline / transaction.
- See Also:
-
addIfAbsent
Addtuples
to a sorted set atkey
if it does not already exists.- Parameters:
key
- must not be null.tuples
- must not be null.- Returns:
- null when used in pipeline / transaction.
- Since:
- 2.5
- See Also:
-
remove
Removevalues
from sorted set. Return number of removed elements.- Parameters:
key
- must not be null.values
- must not be null.- Returns:
- null when used in pipeline / transaction.
- See Also:
-
incrementScore
Increment the score of element withvalue
in sorted set byincrement
.- Parameters:
key
- must not be null.value
- the value.delta
- the delta to add. Can be negative.- Returns:
- null when used in pipeline / transaction.
- See Also:
-
randomMember
Get random element from set atkey
.- Parameters:
key
- must not be null.- Returns:
- null when used in pipeline / transaction.
- Since:
- 2.6
- See Also:
-
distinctRandomMembers
Getcount
distinct random elements from set atkey
.- Parameters:
key
- must not be null.count
- number of members to return.- Returns:
- empty
Set
ifkey
does not exist. - Throws:
IllegalArgumentException
- if count is negative.- Since:
- 2.6
- See Also:
-
randomMembers
Getcount
random elements from set atkey
.- Parameters:
key
- must not be null.count
- number of members to return.- Returns:
- empty
List
ifkey
does not exist or null when used in pipeline / transaction. - Throws:
IllegalArgumentException
- if count is negative.- Since:
- 2.6
- See Also:
-
randomMemberWithScore
Get random element with its score from set atkey
.- Parameters:
key
- must not be null.- Returns:
- null when used in pipeline / transaction.
- Since:
- 2.6
- See Also:
-
distinctRandomMembersWithScore
Getcount
distinct random elements with their score from set atkey
.- Parameters:
key
- must not be null.count
- number of members to return.- Returns:
- empty
Set
ifkey
does not exist. - Throws:
IllegalArgumentException
- if count is negative.- Since:
- 2.6
- See Also:
-
randomMembersWithScore
Getcount
random elements with their score from set atkey
.- Parameters:
key
- must not be null.count
- number of members to return.- Returns:
- empty
List
ifkey
does not exist or null when used in pipeline / transaction. - Throws:
IllegalArgumentException
- if count is negative.- Since:
- 2.6
- See Also:
-
rank
Determine the index of element withvalue
in a sorted set.- Parameters:
key
- must not be null.o
- the value.- Returns:
- null when used in pipeline / transaction.
- See Also:
-
reverseRank
Determine the index of element withvalue
in a sorted set when scored high to low.- Parameters:
key
- must not be null.o
- the value.- Returns:
- null when used in pipeline / transaction.
- See Also:
-
range
Get elements betweenstart
andend
from sorted set.- Parameters:
key
- must not be null.start
-end
-- Returns:
- null when used in pipeline / transaction.
- See Also:
-
rangeWithScores
- Parameters:
key
- must not be null.start
-end
-- Returns:
- null when used in pipeline / transaction.
- See Also:
-
rangeByScore
Get elements where score is betweenmin
andmax
from sorted set.- Parameters:
key
- must not be null.min
-max
-- Returns:
- null when used in pipeline / transaction.
- See Also:
-
rangeByScoreWithScores
- Parameters:
key
- must not be null.min
-max
-- Returns:
- null when used in pipeline / transaction.
- See Also:
-
rangeByScore
Get elements in range fromstart
toend
where score is betweenmin
andmax
from sorted set.- Parameters:
key
- must not be null.min
-max
-offset
-count
-- Returns:
- null when used in pipeline / transaction.
- See Also:
-
rangeByScoreWithScores
@Nullable Set<ZSetOperations.TypedTuple<V>> rangeByScoreWithScores(K key, double min, double max, long offset, long count) - Parameters:
key
-min
-max
-offset
-count
-- Returns:
- null when used in pipeline / transaction.
- See Also:
-
reverseRange
Get elements in range fromstart
toend
from sorted set ordered from high to low.- Parameters:
key
- must not be null.start
-end
-- Returns:
- null when used in pipeline / transaction.
- See Also:
-
reverseRangeWithScores
- Parameters:
key
- must not be null.start
-end
-- Returns:
- null when used in pipeline / transaction.
- See Also:
-
reverseRangeByScore
Get elements where score is betweenmin
andmax
from sorted set ordered from high to low.- Parameters:
key
- must not be null.min
-max
-- Returns:
- null when used in pipeline / transaction.
- See Also:
-
reverseRangeByScoreWithScores
@Nullable Set<ZSetOperations.TypedTuple<V>> reverseRangeByScoreWithScores(K key, double min, double max) - Parameters:
key
- must not be null.min
-max
-- Returns:
- null when used in pipeline / transaction.
- See Also:
-
reverseRangeByScore
Get elements in range fromstart
toend
where score is betweenmin
andmax
from sorted set ordered high -> low.- Parameters:
key
- must not be null.min
-max
-offset
-count
-- Returns:
- null when used in pipeline / transaction.
- See Also:
-
reverseRangeByScoreWithScores
@Nullable Set<ZSetOperations.TypedTuple<V>> reverseRangeByScoreWithScores(K key, double min, double max, long offset, long count) Get set ofTuple
in range fromstart
toend
where score is betweenmin
andmax
from sorted set ordered high -> low.- Parameters:
key
- must not be null.min
-max
-offset
-count
-- Returns:
- null when used in pipeline / transaction.
- See Also:
-
count
Count number of elements within sorted set with scores betweenmin
andmax
.- Parameters:
key
- must not be null.min
-max
-- Returns:
- null when used in pipeline / transaction.
- See Also:
-
lexCount
@Nullable @Deprecated(since="3.0", forRemoval=true) default Long lexCount(K key, RedisZSetCommands.Range range) Deprecated, for removal: This API element is subject to removal in a future version.since 3.0. Please use #lexCount(Range) instead.Count number of elements within sorted set with value betweenRange.getLowerBound()
andRange.getUpperBound()
applying lexicographical ordering.- Parameters:
key
- must not be null.range
- must not be null.- Returns:
- null when used in pipeline / transaction.
- Since:
- 2.4
- See Also:
-
lexCount
Count number of elements within sorted set with value betweenRange.getLowerBound()
andRange.getUpperBound()
applying lexicographical ordering.- Parameters:
key
- must not be null.range
- must not be null.- Returns:
- null when used in pipeline / transaction.
- Since:
- 3.0
- See Also:
-
popMin
Remove and return the value with its score having the lowest score from sorted set atkey
.- Parameters:
key
- must not be null.- Returns:
- null when the sorted set is empty or used in pipeline / transaction.
- Since:
- 2.6
- See Also:
-
popMin
Remove and returncount
values with their score having the lowest score from sorted set atkey
.- Parameters:
key
- must not be null.count
- number of elements to pop.- Returns:
- null when the sorted set is empty or used in pipeline / transaction.
- Since:
- 2.6
- See Also:
-
popMin
Remove and return the value with its score having the lowest score from sorted set atkey
.
Blocks connection until element available ortimeout
reached.- Parameters:
key
- must not be null.timeout
-unit
- must not be null.- Returns:
- can be null.
- Since:
- 2.6
- See Also:
-
popMin
Remove and return the value with its score having the lowest score from sorted set atkey
.
Blocks connection until element available ortimeout
reached.- Parameters:
key
- must not be null.timeout
- must not be null.- Returns:
- can be null.
- Throws:
IllegalArgumentException
- if the timeout is null or negative.- Since:
- 2.6
- See Also:
-
popMax
Remove and return the value with its score having the highest score from sorted set atkey
.- Parameters:
key
- must not be null.- Returns:
- null when the sorted set is empty or used in pipeline / transaction.
- Since:
- 2.6
- See Also:
-
popMax
Remove and returncount
values with their score having the highest score from sorted set atkey
.- Parameters:
key
- must not be null.count
- number of elements to pop.- Returns:
- null when the sorted set is empty or used in pipeline / transaction.
- Since:
- 2.6
- See Also:
-
popMax
Remove and return the value with its score having the highest score from sorted set atkey
.
Blocks connection until element available ortimeout
reached.- Parameters:
key
- must not be null.timeout
-unit
- must not be null.- Returns:
- can be null.
- Since:
- 2.6
- See Also:
-
popMax
Remove and return the value with its score having the highest score from sorted set atkey
.
Blocks connection until element available ortimeout
reached.- Parameters:
key
- must not be null.timeout
- must not be null.- Returns:
- can be null.
- Throws:
IllegalArgumentException
- if the timeout is null or negative.- Since:
- 2.6
- See Also:
-
size
Returns the number of elements of the sorted set stored with givenkey
.- Parameters:
key
-- Returns:
- null when used in pipeline / transaction.
- See Also:
-
zCard
Get the size of sorted set withkey
.- Parameters:
key
- must not be null.- Returns:
- null when used in pipeline / transaction.
- Since:
- 1.3
- See Also:
-
score
Get the score of element withvalue
from sorted set with keykey
.- Parameters:
key
- must not be null.o
- the value.- Returns:
- null when used in pipeline / transaction.
- See Also:
-
score
Get the scores of elements withvalues
from sorted set with keykey
.- Parameters:
key
- must not be null.o
- the values.- Returns:
- null when used in pipeline / transaction.
- Since:
- 2.6
- See Also:
-
removeRange
Remove elements in range betweenstart
andend
from sorted set withkey
.- Parameters:
key
- must not be null.start
-end
-- Returns:
- null when used in pipeline / transaction.
- See Also:
-
removeRangeByLex
@Nullable @Deprecated(since="3.0", forRemoval=true) default Long removeRangeByLex(K key, RedisZSetCommands.Range range) Deprecated, for removal: This API element is subject to removal in a future version.since 3.0. Please useremoveRangeByLex(Object, Range)
instead;Remove elements inRange
from sorted set with key.- Parameters:
key
- must not be null.range
- must not be null.- Returns:
- null when used in pipeline / transaction.
- Since:
- 2.5
- See Also:
-
removeRangeByLex
Remove elements inRange
from sorted set with key.- Parameters:
key
- must not be null.range
- must not be null.- Returns:
- null when used in pipeline / transaction.
- Since:
- 3.0
- See Also:
-
removeRangeByScore
Remove elements with scores betweenmin
andmax
from sorted set withkey
.- Parameters:
key
- must not be null.min
-max
-- Returns:
- null when used in pipeline / transaction.
- See Also:
-
difference
Diff sortedsets
.- Parameters:
key
- must not be null.otherKey
- must not be null.- Returns:
- null when used in pipeline / transaction.
- Since:
- 2.6
- See Also:
-
difference
Diff sortedsets
.- Parameters:
key
- must not be null.otherKeys
- must not be null.- Returns:
- null when used in pipeline / transaction.
- Since:
- 2.6
- See Also:
-
differenceWithScores
Diff sortedsets
.- Parameters:
key
- must not be null.otherKey
- must not be null.- Returns:
- null when used in pipeline / transaction.
- Since:
- 2.6
- See Also:
-
differenceWithScores
Diff sortedsets
.- Parameters:
key
- must not be null.otherKeys
- must not be null.- Returns:
- null when used in pipeline / transaction.
- Since:
- 2.6
- See Also:
-
differenceAndStore
Diff sortedsets
and store result in destinationdestKey
.- Parameters:
key
- must not be null.otherKeys
- must not be null.destKey
- must not be null.- Returns:
- null when used in pipeline / transaction.
- Since:
- 2.6
- See Also:
-
intersect
Intersect sortedsets
.- Parameters:
key
- must not be null.otherKey
- must not be null.- Returns:
- null when used in pipeline / transaction.
- Since:
- 2.6
- See Also:
-
intersect
Intersect sortedsets
.- Parameters:
key
- must not be null.otherKeys
- must not be null.- Returns:
- null when used in pipeline / transaction.
- Since:
- 2.6
- See Also:
-
intersectWithScores
Intersect sortedsets
.- Parameters:
key
- must not be null.otherKey
- must not be null.- Returns:
- null when used in pipeline / transaction.
- Since:
- 2.6
- See Also:
-
intersectWithScores
Intersect sortedsets
.- Parameters:
key
- must not be null.otherKeys
- must not be null.- Returns:
- null when used in pipeline / transaction.
- Since:
- 2.6
- See Also:
-
intersectWithScores
@Nullable default Set<ZSetOperations.TypedTuple<V>> intersectWithScores(K key, Collection<K> otherKeys, Aggregate aggregate) Intersect sorted sets atkey
andotherKeys
.- Parameters:
key
- must not be null.otherKeys
- must not be null.aggregate
- must not be null.- Returns:
- null when used in pipeline / transaction.
- Since:
- 2.6
- See Also:
-
intersectWithScores
@Nullable Set<ZSetOperations.TypedTuple<V>> intersectWithScores(K key, Collection<K> otherKeys, Aggregate aggregate, Weights weights) Intersect sortedsets
.- Parameters:
key
- must not be null.otherKeys
- must not be null.aggregate
- must not be null.weights
- must not be null.- Returns:
- Since:
- 2.6
- See Also:
-
intersectAndStore
Intersect sorted sets atkey
andotherKey
and store result in destinationdestKey
.- Parameters:
key
- must not be null.otherKey
- must not be null.destKey
- must not be null.- Returns:
- null when used in pipeline / transaction.
- See Also:
-
intersectAndStore
Intersect sorted sets atkey
andotherKeys
and store result in destinationdestKey
.- Parameters:
key
- must not be null.otherKeys
- must not be null.destKey
- must not be null.- Returns:
- null when used in pipeline / transaction.
- See Also:
-
intersectAndStore
@Nullable default Long intersectAndStore(K key, Collection<K> otherKeys, K destKey, Aggregate aggregate) Intersect sorted sets atkey
andotherKeys
and store result in destinationdestKey
.- Parameters:
key
- must not be null.otherKeys
- must not be null.destKey
- must not be null.aggregate
- must not be null.- Returns:
- null when used in pipeline / transaction.
- Since:
- 2.1
- See Also:
-
intersectAndStore
@Nullable Long intersectAndStore(K key, Collection<K> otherKeys, K destKey, Aggregate aggregate, Weights weights) Intersect sorted sets atkey
andotherKeys
and store result in destinationdestKey
.- Parameters:
key
- must not be null.otherKeys
- must not be null.destKey
- must not be null.aggregate
- must not be null.weights
- must not be null.- Returns:
- null when used in pipeline / transaction.
- Since:
- 2.1
- See Also:
-
union
Union sortedsets
.- Parameters:
key
- must not be null.otherKey
- must not be null.- Returns:
- null when used in pipeline / transaction.
- Since:
- 2.6
- See Also:
-
union
Union sortedsets
.- Parameters:
key
- must not be null.otherKeys
- must not be null.- Returns:
- null when used in pipeline / transaction.
- Since:
- 2.6
- See Also:
-
unionWithScores
Union sortedsets
.- Parameters:
key
- must not be null.otherKey
- must not be null.- Returns:
- null when used in pipeline / transaction.
- Since:
- 2.6
- See Also:
-
unionWithScores
Union sortedsets
.- Parameters:
key
- must not be null.otherKeys
- must not be null.- Returns:
- null when used in pipeline / transaction.
- Since:
- 2.6
- See Also:
-
unionWithScores
@Nullable default Set<ZSetOperations.TypedTuple<V>> unionWithScores(K key, Collection<K> otherKeys, Aggregate aggregate) Union sorted sets atkey
andotherKeys
.- Parameters:
key
- must not be null.otherKeys
- must not be null.aggregate
- must not be null.- Returns:
- null when used in pipeline / transaction.
- Since:
- 2.6
- See Also:
-
unionWithScores
@Nullable Set<ZSetOperations.TypedTuple<V>> unionWithScores(K key, Collection<K> otherKeys, Aggregate aggregate, Weights weights) Union sortedsets
.- Parameters:
key
- must not be null.otherKeys
- must not be null.aggregate
- must not be null.weights
- must not be null.- Returns:
- null when used in pipeline / transaction.
- Since:
- 2.6
- See Also:
-
unionAndStore
Union sorted sets atkey
andotherKeys
and store result in destinationdestKey
.- Parameters:
key
- must not be null.otherKey
- must not be null.destKey
- must not be null.- Returns:
- null when used in pipeline / transaction.
- See Also:
-
unionAndStore
Union sorted sets atkey
andotherKeys
and store result in destinationdestKey
.- Parameters:
key
- must not be null.otherKeys
- must not be null.destKey
- must not be null.- Returns:
- null when used in pipeline / transaction.
- See Also:
-
unionAndStore
@Nullable default Long unionAndStore(K key, Collection<K> otherKeys, K destKey, Aggregate aggregate) Union sorted sets atkey
andotherKeys
and store result in destinationdestKey
.- Parameters:
key
- must not be null.otherKeys
- must not be null.destKey
- must not be null.aggregate
- must not be null.- Returns:
- null when used in pipeline / transaction.
- Since:
- 2.1
- See Also:
-
unionAndStore
@Nullable Long unionAndStore(K key, Collection<K> otherKeys, K destKey, Aggregate aggregate, Weights weights) Union sorted sets atkey
andotherKeys
and store result in destinationdestKey
.- Parameters:
key
- must not be null.otherKeys
- must not be null.destKey
- must not be null.aggregate
- must not be null.weights
- must not be null.- Returns:
- null when used in pipeline / transaction.
- Since:
- 2.1
- See Also:
-
scan
Use aCursor
to iterate over entries zset atkey
.
Important: CallCloseableIterator.close()
when done to avoid resource leaks.- Parameters:
key
-options
- must not be null.- Returns:
- the result cursor providing access to the scan result. Must be closed once fully processed (e.g. through a try-with-resources clause).
- Since:
- 1.4
- See Also:
-
rangeByLex
@Nullable @Deprecated(since="3.0", forRemoval=true) default Set<V> rangeByLex(K key, RedisZSetCommands.Range range) Deprecated, for removal: This API element is subject to removal in a future version.since 3.0. Please userangeByLex(Object, Range)
instead.Get all elements with lexicographical ordering from ZSET atkey
with a value betweenRedisZSetCommands.Range.getMin()
andRedisZSetCommands.Range.getMax()
.- Parameters:
key
- must not be null.range
- must not be null.- Returns:
- null when used in pipeline / transaction.
- Since:
- 1.7
- See Also:
-
rangeByLex
Get all elements with lexicographical ordering from ZSET atkey
with a value betweenRange.getLowerBound()
andRange.getUpperBound()
.- Parameters:
key
- must not be null.range
- must not be null.- Returns:
- null when used in pipeline / transaction.
- Since:
- 3.0
- See Also:
-
rangeByLex
@Nullable @Deprecated(since="3.0", forRemoval=true) default Set<V> rangeByLex(K key, RedisZSetCommands.Range range, Limit limit) Deprecated, for removal: This API element is subject to removal in a future version.since 3.0. Please userangeByLex(Object, Range, Limit)
instead.Get all elements n elements, where n =Limit.getCount()
, starting atLimit.getOffset()
with lexicographical ordering from ZSET atkey
with a value betweenRedisZSetCommands.Range.getMin()
andRedisZSetCommands.Range.getMax()
.- Parameters:
key
- must not be nullrange
- must not be null.limit
- can be null.- Returns:
- null when used in pipeline / transaction.
- Since:
- 1.7
- See Also:
-
rangeByLex
Get all elements n elements, where n =Limit.getCount()
, starting atLimit.getOffset()
with lexicographical ordering from ZSET atkey
with a value betweenRange.getLowerBound()
andRange.getUpperBound()
.- Parameters:
key
- must not be nullrange
- must not be null.limit
- can be null.- Returns:
- null when used in pipeline / transaction.
- Since:
- 3.0
- See Also:
-
reverseRangeByLex
@Nullable @Deprecated(since="3.0", forRemoval=true) default Set<V> reverseRangeByLex(K key, RedisZSetCommands.Range range) Deprecated, for removal: This API element is subject to removal in a future version.since 3.0. Please usereverseRangeByLex(Object, Range)
Get all elements with reverse lexicographical ordering from ZSET atkey
with a value betweenRedisZSetCommands.Range.getMin()
andRedisZSetCommands.Range.getMax()
.- Parameters:
key
- must not be null.range
- must not be null.- Returns:
- null when used in pipeline / transaction.
- Since:
- 2.4
- See Also:
-
reverseRangeByLex
Get all elements with reverse lexicographical ordering from ZSET atkey
with a value betweenRange.getLowerBound()
andRange.getUpperBound()
.- Parameters:
key
- must not be null.range
- must not be null.- Returns:
- null when used in pipeline / transaction.
- Since:
- 3.0
- See Also:
-
reverseRangeByLex
@Nullable @Deprecated(since="3.0", forRemoval=true) default Set<V> reverseRangeByLex(K key, RedisZSetCommands.Range range, Limit limit) Deprecated, for removal: This API element is subject to removal in a future version.since 3.0. Please usereverseRangeByLex(Object, Range, Limit)
instead.Get all elements n elements, where n =Limit.getCount()
, starting atLimit.getOffset()
with reverse lexicographical ordering from ZSET atkey
with a value betweenRedisZSetCommands.Range.getMin()
andRedisZSetCommands.Range.getMax()
.- Parameters:
key
- must not be null.range
- must not be null.limit
- can be null.- Returns:
- null when used in pipeline / transaction.
- Since:
- 2.4
- See Also:
-
reverseRangeByLex
Get all elements n elements, where n =Limit.getCount()
, starting atLimit.getOffset()
with reverse lexicographical ordering from ZSET atkey
with a value betweenRange.getLowerBound()
andRange.getUpperBound()
.- Parameters:
key
- must not be null.range
- must not be null.limit
- can be null.- Returns:
- null when used in pipeline / transaction.
- Since:
- 2.4
- See Also:
-
rangeAndStoreByLex
Store all elements atdstKey
with lexicographical ordering from ZSET atsrcKey
with a value betweenRange.getLowerBound()
andRange.getUpperBound()
.- Parameters:
srcKey
- must not be null.dstKey
- must not be null.range
- must not be null.- Returns:
- the number of stored elements or null when used in pipeline / transaction.
- Since:
- 3.0
- See Also:
-
rangeAndStoreByLex
Store n elements atdstKey
, where n =Limit.getCount()
, starting atLimit.getOffset()
with lexicographical ordering from ZSET atsrcKey
with a value betweenRange.getLowerBound()
andRange.getUpperBound()
.- Parameters:
srcKey
- must not be null.dstKey
- must not be null.range
- must not be null.limit
- must not be null.- Returns:
- the number of stored elements or null when used in pipeline / transaction.
- Since:
- 3.0
- See Also:
-
reverseRangeAndStoreByLex
Store all elements atdstKey
with reverse lexicographical ordering from ZSET atsrcKey
with a value betweenRange.getLowerBound()
andRange.getUpperBound()
.- Parameters:
srcKey
- must not be null.dstKey
- must not be null.range
- must not be null.- Returns:
- the number of stored elements or null when used in pipeline / transaction.
- Since:
- 3.0
- See Also:
-
reverseRangeAndStoreByLex
Store n elements atdstKey
, where n =Limit.getCount()
, starting atLimit.getOffset()
with reverse lexicographical ordering from ZSET atsrcKey
with a value betweenRange.getLowerBound()
andRange.getUpperBound()
.- Parameters:
srcKey
- must not be null.dstKey
- must not be null.range
- must not be null.limit
- must not be null.- Returns:
- the number of stored elements or null when used in pipeline / transaction.
- Since:
- 3.0
- See Also:
-
rangeAndStoreByScore
Store all elements atdstKey
with ordering by score from ZSET atsrcKey
with a score betweenRange.getLowerBound()
andRange.getUpperBound()
.- Parameters:
srcKey
- must not be null.dstKey
- must not be null.range
- must not be null.- Returns:
- the number of stored elements or null when used in pipeline / transaction.
- Since:
- 3.0
- See Also:
-
rangeAndStoreByScore
Store n elements atdstKey
, where n =Limit.getCount()
, starting atLimit.getOffset()
with ordering by score from ZSET atsrcKey
with a score betweenRange.getLowerBound()
andRange.getUpperBound()
.- Parameters:
srcKey
- must not be null.dstKey
- must not be null.range
- must not be null.limit
- must not be null.- Returns:
- the number of stored elements or null when used in pipeline / transaction.
- Since:
- 3.0
- See Also:
-
reverseRangeAndStoreByScore
@Nullable default Long reverseRangeAndStoreByScore(K srcKey, K dstKey, Range<? extends Number> range) Store all elements atdstKey
with reverse ordering by score from ZSET atsrcKey
with a score betweenRange.getLowerBound()
andRange.getUpperBound()
.- Parameters:
srcKey
- must not be null.dstKey
- must not be null.range
- must not be null.- Returns:
- the number of stored elements or null when used in pipeline / transaction.
- Since:
- 3.0
- See Also:
-
reverseRangeAndStoreByScore
@Nullable Long reverseRangeAndStoreByScore(K srcKey, K dstKey, Range<? extends Number> range, Limit limit) Store n elements atdstKey
, where n =Limit.getCount()
, starting atLimit.getOffset()
with reverse ordering by score from ZSET atsrcKey
with a score betweenRange.getLowerBound()
andRange.getUpperBound()
.- Parameters:
srcKey
- must not be null.dstKey
- must not be null.range
- must not be null.limit
- must not be null.- Returns:
- the number of stored elements or null when used in pipeline / transaction.
- Since:
- 3.0
- See Also:
-
getOperations
RedisOperations<K,V> getOperations()- Returns:
- never null.
-