public class DefaultRedisZSet<E> extends AbstractRedisCollection<E> implements RedisZSet<E>
RedisZSet
. Note that the collection support works only with normal,
non-pipeline/multi-exec connections as it requires a reply to be sent right away.ENCODING
Constructor and Description |
---|
DefaultRedisZSet(BoundZSetOperations<String,E> boundOps)
Constructs a new
DefaultRedisZSet instance with a default score of '1'. |
DefaultRedisZSet(BoundZSetOperations<String,E> boundOps,
double defaultScore)
Constructs a new
DefaultRedisZSet instance. |
DefaultRedisZSet(String key,
RedisOperations<String,E> operations)
Constructs a new
DefaultRedisZSet instance with a default score of '1'. |
DefaultRedisZSet(String key,
RedisOperations<String,E> operations,
double defaultScore)
Constructs a new
DefaultRedisSortedSet instance. |
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.
|
void |
clear() |
boolean |
contains(Object o) |
E |
first()
Returns the first (lowest) element currently in this sorted set.
|
Double |
getDefaultScore()
Returns the default score used by this set.
|
DataType |
getType()
Returns the associated Redis type.
|
RedisZSet<E> |
intersectAndStore(Collection<? extends RedisZSet<?>> sets,
String destKey) |
RedisZSet<E> |
intersectAndStore(RedisZSet<?> set,
String destKey) |
Iterator<E> |
iterator() |
E |
last()
Returns the last (highest) element currently in this sorted set.
|
Set<E> |
range(long start,
long end) |
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) |
Set<ZSetOperations.TypedTuple<E>> |
rangeByScoreWithScores(double min,
double max) |
Set<ZSetOperations.TypedTuple<E>> |
rangeWithScores(long start,
long end) |
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) |
boolean |
remove(Object o) |
RedisZSet<E> |
removeByScore(double min,
double max) |
Set<E> |
reverseRange(long start,
long end) |
Set<E> |
reverseRangeByScore(double min,
double max) |
Set<ZSetOperations.TypedTuple<E>> |
reverseRangeByScoreWithScores(double min,
double max) |
Set<ZSetOperations.TypedTuple<E>> |
reverseRangeWithScores(long start,
long end) |
Long |
reverseRank(Object o)
Returns the rank (position) of the given element in the set, in descending order.
|
Cursor<E> |
scan() |
Cursor<ZSetOperations.TypedTuple<E>> |
scan(ScanOptions options) |
Double |
score(Object o)
Returns the score of the given element.
|
int |
size() |
RedisZSet<E> |
unionAndStore(Collection<? extends RedisZSet<?>> sets,
String destKey) |
RedisZSet<E> |
unionAndStore(RedisZSet<?> set,
String destKey) |
addAll, checkResult, containsAll, equals, expire, expireAt, getExpire, getKey, getOperations, hashCode, persist, removeAll, rename, toString
isEmpty, retainAll, toArray, toArray
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
getOperations
expire, expireAt, getExpire, getKey, persist, rename
addAll, containsAll, equals, hashCode, isEmpty, removeAll, retainAll, spliterator, toArray, toArray
parallelStream, removeIf, stream
public DefaultRedisZSet(String key, RedisOperations<String,E> operations)
DefaultRedisZSet
instance with a default score of '1'.key
- operations
- public DefaultRedisZSet(String key, RedisOperations<String,E> operations, double defaultScore)
DefaultRedisSortedSet
instance.key
- operations
- defaultScore
- public DefaultRedisZSet(BoundZSetOperations<String,E> boundOps)
DefaultRedisZSet
instance with a default score of '1'.boundOps
- public DefaultRedisZSet(BoundZSetOperations<String,E> boundOps, double defaultScore)
DefaultRedisZSet
instance.boundOps
- defaultScore
- public RedisZSet<E> intersectAndStore(RedisZSet<?> set, String destKey)
intersectAndStore
in interface RedisZSet<E>
public RedisZSet<E> intersectAndStore(Collection<? extends RedisZSet<?>> sets, String destKey)
intersectAndStore
in interface RedisZSet<E>
public Set<E> reverseRange(long start, long end)
reverseRange
in interface RedisZSet<E>
public Set<E> rangeByLex(RedisZSetCommands.Range range)
RedisZSet
RedisZSetCommands.Range.getMin()
and
RedisZSetCommands.Range.getMax()
.rangeByLex
in interface RedisZSet<E>
range
- must not be null.BoundZSetOperations#rangeByLex(Range)
public Set<E> rangeByLex(RedisZSetCommands.Range range, RedisZSetCommands.Limit limit)
RedisZSet
RedisZSetCommands.Limit.getCount()
, starting at
RedisZSetCommands.Limit.getOffset()
with lexicographical ordering having a value between RedisZSetCommands.Range.getMin()
and
RedisZSetCommands.Range.getMax()
.rangeByLex
in interface RedisZSet<E>
range
- must not be null.limit
- can be null.BoundZSetOperations#rangeByLex(Range, Limit)
public Set<E> rangeByScore(double min, double max)
rangeByScore
in interface RedisZSet<E>
public Set<E> reverseRangeByScore(double min, double max)
reverseRangeByScore
in interface RedisZSet<E>
public Set<ZSetOperations.TypedTuple<E>> rangeByScoreWithScores(double min, double max)
rangeByScoreWithScores
in interface RedisZSet<E>
public Set<ZSetOperations.TypedTuple<E>> rangeWithScores(long start, long end)
rangeWithScores
in interface RedisZSet<E>
public Set<ZSetOperations.TypedTuple<E>> reverseRangeByScoreWithScores(double min, double max)
reverseRangeByScoreWithScores
in interface RedisZSet<E>
public Set<ZSetOperations.TypedTuple<E>> reverseRangeWithScores(long start, long end)
reverseRangeWithScores
in interface RedisZSet<E>
public RedisZSet<E> removeByScore(double min, double max)
removeByScore
in interface RedisZSet<E>
public RedisZSet<E> unionAndStore(RedisZSet<?> set, String destKey)
unionAndStore
in interface RedisZSet<E>
public RedisZSet<E> unionAndStore(Collection<? extends RedisZSet<?>> sets, String destKey)
unionAndStore
in interface RedisZSet<E>
public boolean add(E e)
RedisZSet
add(e, getDefaultScore())
. The score value
is implementation specific. public boolean add(E e, double score)
RedisZSet
public void clear()
clear
in interface Collection<E>
clear
in interface Set<E>
clear
in class AbstractCollection<E>
public boolean contains(Object o)
contains
in interface Collection<E>
contains
in interface Set<E>
contains
in class AbstractCollection<E>
public boolean remove(Object o)
remove
in interface Collection<E>
remove
in interface Set<E>
remove
in class AbstractCollection<E>
public int size()
size
in interface Collection<E>
size
in interface Set<E>
size
in class AbstractCollection<E>
public Double getDefaultScore()
RedisZSet
getDefaultScore
in interface RedisZSet<E>
public E first()
RedisZSet
public E last()
RedisZSet
public Long rank(Object o)
RedisZSet
public Long reverseRank(Object o)
RedisZSet
reverseRank
in interface RedisZSet<E>
o
- objectpublic Double score(Object o)
RedisZSet
public DataType getType()
BoundKeyOperations
getType
in interface BoundKeyOperations<String>
public Cursor<ZSetOperations.TypedTuple<E>> scan(ScanOptions options)
options
- Copyright © 2011-2016–2016 Pivotal Software, Inc.. All rights reserved.