public interface RedisZSet<E> extends RedisCollection<E>, Set<E>
SortedSet based on the given priorities or weights
associated with each item.
Since using a Comparator does not apply, a ZSet implements the SortedSet methods where applicable.
| Modifier and Type | Method and Description |
|---|---|
boolean |
add(E e)
Adds an element to the set with a default score.
|
boolean |
add(E e,
double score)
Adds an element to the set with the given score, or updates the score if the element exists.
|
default boolean |
addIfAbsent(E e)
Adds an element to the set using the
default score if the element does not already exists. |
boolean |
addIfAbsent(E e,
double score)
Adds an element to the set with the given score if the element does not already exists.
|
static <E> RedisZSet<E> |
create(String key,
RedisOperations<String,E> operations)
Constructs a new
RedisZSet instance with a default score of 1. |
static <E> RedisZSet<E> |
create(String key,
RedisOperations<String,E> operations,
double defaultScore)
Constructs a new
RedisZSet instance. |
Set<E> |
diff(Collection<? extends RedisZSet<?>> sets)
Diff this set and other
RedisZSets. |
Set<E> |
diff(RedisZSet<?> set)
Diff this set and another
RedisZSet. |
RedisZSet<E> |
diffAndStore(Collection<? extends RedisZSet<?>> sets,
String destKey)
|
RedisZSet<E> |
diffAndStore(RedisZSet<?> set,
String destKey)
|
Set<ZSetOperations.TypedTuple<E>> |
diffWithScores(Collection<? extends RedisZSet<?>> sets)
Diff this set and other
RedisZSets. |
Set<ZSetOperations.TypedTuple<E>> |
diffWithScores(RedisZSet<?> set)
Diff this set and another
RedisZSet. |
E |
first()
Returns the first (lowest) element currently in this sorted set.
|
Double |
getDefaultScore()
Returns the default score used by this set.
|
Set<E> |
intersect(Collection<? extends RedisZSet<?>> sets)
Intersect this set and other
RedisZSets. |
Set<E> |
intersect(RedisZSet<?> set)
Intersect this set and another
RedisZSet. |
RedisZSet<E> |
intersectAndStore(Collection<? extends RedisZSet<?>> sets,
String destKey)
|
RedisZSet<E> |
intersectAndStore(RedisZSet<?> set,
String destKey)
|
Set<ZSetOperations.TypedTuple<E>> |
intersectWithScores(Collection<? extends RedisZSet<?>> sets)
Intersect this set and other
RedisZSets. |
Set<ZSetOperations.TypedTuple<E>> |
intersectWithScores(RedisZSet<?> set)
Intersect this set and another
RedisZSet. |
E |
last()
Returns the last (highest) element currently in this sorted set.
|
Long |
lexCount(RedisZSetCommands.Range range)
Count number of elements within sorted set with value between
Range#min and Range#max applying
lexicographical ordering. |
E |
popFirst()
Removes the first (lowest) object at the top of this sorted set and returns that object as the value of this
function.
|
E |
popFirst(long timeout,
TimeUnit unit)
Removes the first (lowest) object at the top of this sorted set and returns that object as the value of this
function.
|
E |
popLast()
Removes the last (highest) object at the top of this sorted set and returns that object as the value of this
function.
|
E |
popLast(long timeout,
TimeUnit unit)
Removes the last (highest) object at the top of this sorted set and returns that object as the value of this
function.
|
E |
randomValue()
Get random element from the set.
|
Set<E> |
range(long start,
long end)
Get elements between
start and end from sorted set. |
default Set<E> |
rangeByLex(RedisZSetCommands.Range range)
Get all elements with lexicographical ordering with a value between
RedisZSetCommands.Range.getMin() and
RedisZSetCommands.Range.getMax(). |
Set<E> |
rangeByLex(RedisZSetCommands.Range range,
RedisZSetCommands.Limit limit)
Get all elements n elements, where n =
RedisZSetCommands.Limit.getCount(), starting at
RedisZSetCommands.Limit.getOffset() with lexicographical ordering having a value between RedisZSetCommands.Range.getMin() and
RedisZSetCommands.Range.getMax(). |
Set<E> |
rangeByScore(double min,
double max)
Get elements where score is between
min and max from sorted set. |
Set<ZSetOperations.TypedTuple<E>> |
rangeByScoreWithScores(double min,
double max)
Get set of
RedisZSetCommands.Tuples where score is between min and max from sorted set. |
Set<ZSetOperations.TypedTuple<E>> |
rangeWithScores(long start,
long end)
Get set of
RedisZSetCommands.Tuples between start and end from sorted set. |
Long |
rank(Object o)
Returns the rank (position) of the given element in the set, in ascending order.
|
RedisZSet<E> |
remove(long start,
long end)
Remove elements in range between
start and end from sorted set. |
Set<E> |
removeByLex(RedisZSetCommands.Range range)
Remove all elements in range.
|
RedisZSet<E> |
removeByScore(double min,
double max)
Remove elements with scores between
min and max from sorted set with the bound key. |
Set<E> |
reverseRange(long start,
long end)
Get elements in range from
start to end from sorted set ordered from high to low. |
default Set<E> |
reverseRangeByLex(RedisZSetCommands.Range range)
Get all elements with reverse lexicographical ordering with a value between
RedisZSetCommands.Range.getMin() and
RedisZSetCommands.Range.getMax(). |
Set<E> |
reverseRangeByLex(RedisZSetCommands.Range range,
RedisZSetCommands.Limit limit)
Get all elements n elements, where n =
RedisZSetCommands.Limit.getCount(), starting at
RedisZSetCommands.Limit.getOffset() with reverse lexicographical ordering having a value between RedisZSetCommands.Range.getMin() and
RedisZSetCommands.Range.getMax(). |
Set<E> |
reverseRangeByScore(double min,
double max)
Get elements where score is between
min and max from sorted set ordered from high to low. |
Set<ZSetOperations.TypedTuple<E>> |
reverseRangeByScoreWithScores(double min,
double max)
Get set of
RedisZSetCommands.Tuples where score is between min and max from sorted set
ordered from high to low. |
Set<ZSetOperations.TypedTuple<E>> |
reverseRangeWithScores(long start,
long end)
Get set of
RedisZSetCommands.Tuples in range from start to end from sorted set ordered from
high to low. |
Long |
reverseRank(Object o)
Returns the rank (position) of the given element in the set, in descending order.
|
Iterator<E> |
scan() |
Double |
score(Object o)
Returns the score of the given element.
|
Set<E> |
union(Collection<? extends RedisZSet<?>> sets)
Union this set and other
RedisZSets. |
Set<E> |
union(RedisZSet<?> set)
Union this set and another
RedisZSet. |
RedisZSet<E> |
unionAndStore(Collection<? extends RedisZSet<?>> sets,
String destKey)
|
RedisZSet<E> |
unionAndStore(RedisZSet<?> set,
String destKey)
|
Set<ZSetOperations.TypedTuple<E>> |
unionWithScores(Collection<? extends RedisZSet<?>> sets)
Union this set and other
RedisZSets. |
Set<ZSetOperations.TypedTuple<E>> |
unionWithScores(RedisZSet<?> set)
Union this set and another
RedisZSet. |
getOperationsexpire, expire, expireAt, expireAt, getExpire, getKey, getType, persist, renameaddAll, clear, contains, containsAll, equals, hashCode, isEmpty, iterator, remove, removeAll, retainAll, size, spliterator, toArray, toArrayparallelStream, removeIf, streamstatic <E> RedisZSet<E> create(String key, RedisOperations<String,E> operations)
RedisZSet instance with a default score of 1.key - Redis key of this set.operations - RedisOperations for the value type of this set.static <E> RedisZSet<E> create(String key, RedisOperations<String,E> operations, double defaultScore)
RedisZSet instance.key - Redis key of this set.operations - RedisOperations for the value type of this set.defaultScore - Set<E> diff(RedisZSet<?> set)
RedisZSet.set - must not be null.Set containing the values that differ.Set<E> diff(Collection<? extends RedisZSet<?>> sets)
RedisZSets.sets - must not be null.Set containing the values that differ.Set<ZSetOperations.TypedTuple<E>> diffWithScores(RedisZSet<?> set)
RedisZSet.set - must not be null.Set containing the values that differ with their scores.Set<ZSetOperations.TypedTuple<E>> diffWithScores(Collection<? extends RedisZSet<?>> sets)
RedisZSets.sets - must not be null.Set containing the values that differ with their scores.RedisZSet<E> diffAndStore(RedisZSet<?> set, String destKey)
RedisZSet by diffing this sorted set and RedisZSet and store result in destination
destKey.set - must not be null.destKey - must not be null.RedisZSet pointing at destKey.RedisZSet<E> diffAndStore(Collection<? extends RedisZSet<?>> sets, String destKey)
RedisZSet by diffing this sorted set and the collection RedisZSet and store result in
destination destKey.sets - must not be null.destKey - must not be null.RedisZSet pointing at destKey.Set<E> intersect(RedisZSet<?> set)
RedisZSet.set - must not be null.Set containing the intersecting values.Set<E> intersect(Collection<? extends RedisZSet<?>> sets)
RedisZSets.sets - must not be null.Set containing the intersecting values.Set<ZSetOperations.TypedTuple<E>> intersectWithScores(RedisZSet<?> set)
RedisZSet.set - must not be null.Set containing the intersecting values with their scores.Set<ZSetOperations.TypedTuple<E>> intersectWithScores(Collection<? extends RedisZSet<?>> sets)
RedisZSets.sets - must not be null.Set containing the intersecting values with their scores.RedisZSet<E> intersectAndStore(RedisZSet<?> set, String destKey)
RedisZSet by intersecting this sorted set and RedisZSet and store result in
destination destKey.set - must not be null.destKey - must not be null.RedisZSet pointing at destKeyRedisZSet<E> intersectAndStore(Collection<? extends RedisZSet<?>> sets, String destKey)
RedisZSet by intersecting this sorted set and the collection RedisZSet and store
result in destination destKey.sets - must not be null.destKey - must not be null.RedisZSet pointing at destKeySet<E> union(RedisZSet<?> set)
RedisZSet.set - must not be null.Set containing the combined values.Set<E> union(Collection<? extends RedisZSet<?>> sets)
RedisZSets.sets - must not be null.Set containing the combined values.Set<ZSetOperations.TypedTuple<E>> unionWithScores(RedisZSet<?> set)
RedisZSet.set - must not be null.Set containing the combined values with their scores.Set<ZSetOperations.TypedTuple<E>> unionWithScores(Collection<? extends RedisZSet<?>> sets)
RedisZSets.sets - must not be null.Set containing the combined values with their scores.RedisZSet<E> unionAndStore(RedisZSet<?> set, String destKey)
RedisZSet by union this sorted set and RedisZSet and store result in destination
destKey.set - must not be null.destKey - must not be null.RedisZSet pointing at destKeyRedisZSet<E> unionAndStore(Collection<? extends RedisZSet<?>> sets, String destKey)
RedisZSet by union this sorted set and the collection RedisZSet and store result in
destination destKey.sets - must not be null.destKey - must not be null.RedisZSet pointing at destKeyE randomValue()
Set<E> range(long start, long end)
start and end from sorted set.start - end - Set<E> reverseRange(long start, long end)
start to end from sorted set ordered from high to low.start - end - default Set<E> rangeByLex(RedisZSetCommands.Range range)
RedisZSetCommands.Range.getMin() and
RedisZSetCommands.Range.getMax().range - must not be null.BoundZSetOperations#rangeByLex(Range)Set<E> rangeByLex(RedisZSetCommands.Range range, RedisZSetCommands.Limit limit)
RedisZSetCommands.Limit.getCount(), starting at
RedisZSetCommands.Limit.getOffset() with lexicographical ordering having a value between RedisZSetCommands.Range.getMin() and
RedisZSetCommands.Range.getMax().range - must not be null.limit - can be null.BoundZSetOperations#rangeByLex(Range, Limit)default Set<E> reverseRangeByLex(RedisZSetCommands.Range range)
RedisZSetCommands.Range.getMin() and
RedisZSetCommands.Range.getMax().range - must not be null.BoundZSetOperations#reverseRangeByLex(Range)Set<E> reverseRangeByLex(RedisZSetCommands.Range range, RedisZSetCommands.Limit limit)
RedisZSetCommands.Limit.getCount(), starting at
RedisZSetCommands.Limit.getOffset() with reverse lexicographical ordering having a value between RedisZSetCommands.Range.getMin() and
RedisZSetCommands.Range.getMax().range - must not be null.limit - can be null.BoundZSetOperations#reverseRangeByLex(Range, Limit)Set<E> rangeByScore(double min, double max)
min and max from sorted set.min - max - Set<E> reverseRangeByScore(double min, double max)
min and max from sorted set ordered from high to low.min - max - Set<ZSetOperations.TypedTuple<E>> rangeWithScores(long start, long end)
RedisZSetCommands.Tuples between start and end from sorted set.start - end - Set<ZSetOperations.TypedTuple<E>> reverseRangeWithScores(long start, long end)
RedisZSetCommands.Tuples in range from start to end from sorted set ordered from
high to low.start - end - Set<ZSetOperations.TypedTuple<E>> rangeByScoreWithScores(double min, double max)
RedisZSetCommands.Tuples where score is between min and max from sorted set.min - max - Set<ZSetOperations.TypedTuple<E>> reverseRangeByScoreWithScores(double min, double max)
RedisZSetCommands.Tuples where score is between min and max from sorted set
ordered from high to low.min - max - RedisZSet<E> remove(long start, long end)
start and end from sorted set.start - end - this set.Set<E> removeByLex(RedisZSetCommands.Range range)
range - must not be null.this set.RedisZSet<E> removeByScore(double min, double max)
min and max from sorted set with the bound key.min - max - this set.boolean add(E e, double score)
e - element to addscore - element scoreboolean add(E e)
add(e, getDefaultScore()). The score value
is implementation specific. default boolean addIfAbsent(E e)
default score if the element does not already exists.e - element to addboolean addIfAbsent(E e, double score)
e - element to addscore - element scoreLong lexCount(RedisZSetCommands.Range range)
Range#min and Range#max applying
lexicographical ordering.range - must not be null.Double score(Object o)
o - objectLong rank(Object o)
o - objectLong reverseRank(Object o)
o - objectDouble getDefaultScore()
E first()
NoSuchElementException - sorted set is empty.E popFirst()
NoSuchElementException - sorted set is empty.E popFirst(long timeout, TimeUnit unit)
timeout reached.timeout - unit - must not be null.NoSuchElementException - sorted set is empty.E last()
NoSuchElementException - sorted set is empty.E popLast()
NoSuchElementException - sorted set is empty.E popLast(long timeout, TimeUnit unit)
timeout reached.timeout - unit - must not be null.NoSuchElementException - sorted set is empty.Copyright © 2011–2023 Pivotal Software, Inc.. All rights reserved.