Package org.redisson.api
Interface RScoredSortedSet<V>
-
- Type Parameters:
V
- value
- All Superinterfaces:
Iterable<V>
,RExpirable
,RExpirableAsync
,RObject
,RObjectAsync
,RScoredSortedSetAsync<V>
,RSortable<Set<V>>
,RSortableAsync<Set<V>>
- All Known Subinterfaces:
RGeo<V>
- All Known Implementing Classes:
RedissonGeo
,RedissonLexSortedSet
,RedissonScoredSortedSet
public interface RScoredSortedSet<V> extends RScoredSortedSetAsync<V>, Iterable<V>, RExpirable, RSortable<Set<V>>
- Author:
- Nikita Koksharov
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static class
RScoredSortedSet.Aggregate
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description boolean
add(double score, V object)
Adds element to this set, overrides previous score if it has been already added.Long
addAll(Map<V,Double> objects)
Integer
addAndGetRank(double score, V object)
Adds element to this set, overrides previous score if it has been already added.Integer
addAndGetRevRank(double score, V object)
Adds element to this set, overrides previous score if it has been already added.Double
addScore(V object, Number value)
Integer
addScoreAndGetRank(V object, Number value)
Adds score to element and returns its rankInteger
addScoreAndGetRevRank(V object, Number value)
Adds score to element and returns its reverse rankvoid
clear()
boolean
contains(Object o)
boolean
containsAll(Collection<?> c)
Long
count(double startScore, boolean startScoreInclusive, double endScore, boolean endScoreInclusive)
Returns the number of elements with a score betweenstartScore
andendScore
.Collection<ScoredEntry<V>>
entryRange(double startScore, boolean startScoreInclusive, double endScore, boolean endScoreInclusive)
Collection<ScoredEntry<V>>
entryRange(double startScore, boolean startScoreInclusive, double endScore, boolean endScoreInclusive, int offset, int count)
Collection<ScoredEntry<V>>
entryRange(int startIndex, int endIndex)
Collection<ScoredEntry<V>>
entryRangeReversed(double startScore, boolean startScoreInclusive, double endScore, boolean endScoreInclusive)
Collection<ScoredEntry<V>>
entryRangeReversed(double startScore, boolean startScoreInclusive, double endScore, boolean endScoreInclusive, int offset, int count)
Collection<ScoredEntry<V>>
entryRangeReversed(int startIndex, int endIndex)
V
first()
Returns the head element ornull
if this sorted set is empty.Double
firstScore()
Returns score of the tail element or returnsnull
if this sorted set is empty.Double
getScore(V o)
Returns score of element ornull
if it doesn't exist.int
intersection(String... names)
Intersect provided ScoredSortedSets and store result to current ScoredSortedSetint
intersection(Map<String,Double> nameWithWeight)
Intersect provided ScoredSortedSets mapped to weight multiplier and store result to current ScoredSortedSetint
intersection(RScoredSortedSet.Aggregate aggregate, String... names)
Intersect provided ScoredSortedSets with defined aggregation method and store result to current ScoredSortedSetint
intersection(RScoredSortedSet.Aggregate aggregate, Map<String,Double> nameWithWeight)
Intersect provided ScoredSortedSets mapped to weight multiplier with defined aggregation method and store result to current ScoredSortedSetboolean
isEmpty()
Returnstrue
if this set is emptyIterator<V>
iterator(int count)
Returns an iterator over elements in this set.Iterator<V>
iterator(String pattern)
Returns an iterator over elements in this set.Iterator<V>
iterator(String pattern, int count)
Returns an iterator over elements in this set.V
last()
Returns the tail element ornull
if this sorted set is empty.Double
lastScore()
Returns score of the head element or returnsnull
if this sorted set is empty.<KOut,VOut>
RCollectionMapReduce<V,KOut,VOut>mapReduce()
ReturnsRMapReduce
object associated with this objectV
pollFirst()
Removes and returns the head element ornull
if this sorted set is empty.Collection<V>
pollFirst(int count)
Removes and returns the head elements ornull
if this sorted set is empty.V
pollFirst(long timeout, TimeUnit unit)
Removes and returns the head element ornull
if this sorted set is empty.V
pollFirstFromAny(long timeout, TimeUnit unit, String... queueNames)
Removes and returns first available head element of any sorted set, waiting up to the specified wait time if necessary for an element to become available in any of defined sorted sets including this one.V
pollLast()
Removes and returns the tail element ornull
if this sorted set is empty.Collection<V>
pollLast(int count)
Removes and returns the tail elements ornull
if this sorted set is empty.V
pollLast(long timeout, TimeUnit unit)
Removes and returns the tail element ornull
if this sorted set is empty.V
pollLastFromAny(long timeout, TimeUnit unit, String... queueNames)
Removes and returns first available tail element of any sorted set, waiting up to the specified wait time if necessary for an element to become available in any of defined sorted sets including this one.Integer
rank(V o)
Returns rank of value, with the scores ordered from low to high.Collection<V>
readAll()
Read all values at once.boolean
remove(Object o)
boolean
removeAll(Collection<?> c)
int
removeRangeByRank(int startIndex, int endIndex)
int
removeRangeByScore(double startScore, boolean startScoreInclusive, double endScore, boolean endScoreInclusive)
boolean
retainAll(Collection<?> c)
Integer
revRank(V o)
Returns rank of value, with the scores ordered from high to low.int
size()
Returns size of this set.Object[]
toArray()
<T> T[]
toArray(T[] a)
boolean
tryAdd(double score, V object)
Adds element to this set only if has not been added before.int
union(String... names)
Union provided ScoredSortedSets and store result to current ScoredSortedSetint
union(Map<String,Double> nameWithWeight)
Union provided ScoredSortedSets mapped to weight multiplier and store result to current ScoredSortedSetint
union(RScoredSortedSet.Aggregate aggregate, String... names)
Union provided ScoredSortedSets with defined aggregation method and store result to current ScoredSortedSetint
union(RScoredSortedSet.Aggregate aggregate, Map<String,Double> nameWithWeight)
Union provided ScoredSortedSets mapped to weight multiplier with defined aggregation method and store result to current ScoredSortedSetCollection<V>
valueRange(double startScore, boolean startScoreInclusive, double endScore, boolean endScoreInclusive)
Returns all values betweenstartScore
andendScore
.Collection<V>
valueRange(double startScore, boolean startScoreInclusive, double endScore, boolean endScoreInclusive, int offset, int count)
Collection<V>
valueRange(int startIndex, int endIndex)
Collection<V>
valueRangeReversed(double startScore, boolean startScoreInclusive, double endScore, boolean endScoreInclusive)
Returns all values betweenstartScore
andendScore
in reversed order.Collection<V>
valueRangeReversed(double startScore, boolean startScoreInclusive, double endScore, boolean endScoreInclusive, int offset, int count)
Collection<V>
valueRangeReversed(int startIndex, int endIndex)
-
Methods inherited from interface java.lang.Iterable
forEach, iterator, spliterator
-
Methods inherited from interface org.redisson.api.RExpirable
clearExpire, expire, expireAt, expireAt, remainTimeToLive
-
Methods inherited from interface org.redisson.api.RExpirableAsync
clearExpireAsync, expireAsync, expireAtAsync, expireAtAsync, remainTimeToLiveAsync
-
Methods inherited from interface org.redisson.api.RObject
copy, delete, dump, getCodec, getName, isExists, migrate, move, rename, renamenx, restore, restore, restoreAndReplace, restoreAndReplace, touch, unlink
-
Methods inherited from interface org.redisson.api.RObjectAsync
copyAsync, deleteAsync, dumpAsync, isExistsAsync, migrateAsync, moveAsync, renameAsync, renamenxAsync, restoreAndReplaceAsync, restoreAndReplaceAsync, restoreAsync, restoreAsync, touchAsync, unlinkAsync
-
Methods inherited from interface org.redisson.api.RScoredSortedSetAsync
addAllAsync, addAndGetRankAsync, addAndGetRevRankAsync, addAsync, addScoreAndGetRankAsync, addScoreAndGetRevRankAsync, addScoreAsync, containsAllAsync, containsAsync, countAsync, entryRangeAsync, entryRangeAsync, entryRangeAsync, entryRangeReversedAsync, entryRangeReversedAsync, entryRangeReversedAsync, firstAsync, firstScoreAsync, getScoreAsync, intersectionAsync, intersectionAsync, intersectionAsync, intersectionAsync, lastAsync, lastScoreAsync, pollFirstAsync, pollFirstAsync, pollFirstAsync, pollFirstFromAnyAsync, pollLastAsync, pollLastAsync, pollLastAsync, pollLastFromAnyAsync, rankAsync, readAllAsync, removeAllAsync, removeAsync, removeRangeByRankAsync, removeRangeByScoreAsync, retainAllAsync, revRankAsync, sizeAsync, tryAddAsync, unionAsync, unionAsync, unionAsync, unionAsync, valueRangeAsync, valueRangeAsync, valueRangeAsync, valueRangeReversedAsync, valueRangeReversedAsync, valueRangeReversedAsync
-
Methods inherited from interface org.redisson.api.RSortable
readSort, readSort, readSort, readSort, readSort, readSort, readSortAlpha, readSortAlpha, readSortAlpha, readSortAlpha, readSortAlpha, readSortAlpha, sortTo, sortTo, sortTo, sortTo, sortTo, sortTo
-
Methods inherited from interface org.redisson.api.RSortableAsync
readSortAlphaAsync, readSortAlphaAsync, readSortAlphaAsync, readSortAlphaAsync, readSortAlphaAsync, readSortAlphaAsync, readSortAsync, readSortAsync, readSortAsync, readSortAsync, readSortAsync, readSortAsync, sortToAsync, sortToAsync, sortToAsync, sortToAsync, sortToAsync, sortToAsync
-
-
-
-
Method Detail
-
mapReduce
<KOut,VOut> RCollectionMapReduce<V,KOut,VOut> mapReduce()
ReturnsRMapReduce
object associated with this object- Type Parameters:
KOut
- output keyVOut
- output value- Returns:
- MapReduce instance
-
pollLastFromAny
V pollLastFromAny(long timeout, TimeUnit unit, String... queueNames)
Removes and returns first available tail element of any sorted set, waiting up to the specified wait time if necessary for an element to become available in any of defined sorted sets including this one.Requires Redis 5.0.0 and higher.
- Parameters:
queueNames
- - names of queuetimeout
- how long to wait before giving up, in units ofunit
unit
- aTimeUnit
determining how to interpret thetimeout
parameter- Returns:
- the tail element, or
null
if all sorted sets are empty
-
pollFirstFromAny
V pollFirstFromAny(long timeout, TimeUnit unit, String... queueNames)
Removes and returns first available head element of any sorted set, waiting up to the specified wait time if necessary for an element to become available in any of defined sorted sets including this one.Requires Redis 5.0.0 and higher.
- Parameters:
queueNames
- - names of queuetimeout
- how long to wait before giving up, in units ofunit
unit
- aTimeUnit
determining how to interpret thetimeout
parameter- Returns:
- the head element, or
null
if all sorted sets are empty
-
pollFirst
V pollFirst(long timeout, TimeUnit unit)
Removes and returns the head element ornull
if this sorted set is empty.- Parameters:
timeout
- how long to wait before giving up, in units ofunit
unit
- aTimeUnit
determining how to interpret thetimeout
parameter- Returns:
- the head element,
or
null
if this sorted set is empty
-
pollLast
V pollLast(long timeout, TimeUnit unit)
Removes and returns the tail element ornull
if this sorted set is empty.- Parameters:
timeout
- how long to wait before giving up, in units ofunit
unit
- aTimeUnit
determining how to interpret thetimeout
parameter- Returns:
- the tail element or
null
if this sorted set is empty
-
pollFirst
Collection<V> pollFirst(int count)
Removes and returns the head elements ornull
if this sorted set is empty.- Parameters:
count
- - elements amount- Returns:
- the head element,
or
null
if this sorted set is empty
-
pollLast
Collection<V> pollLast(int count)
Removes and returns the tail elements ornull
if this sorted set is empty.- Parameters:
count
- - elements amount- Returns:
- the tail element or
null
if this sorted set is empty
-
pollFirst
V pollFirst()
Removes and returns the head element ornull
if this sorted set is empty.- Returns:
- the head element,
or
null
if this sorted set is empty
-
pollLast
V pollLast()
Removes and returns the tail element ornull
if this sorted set is empty.- Returns:
- the tail element or
null
if this sorted set is empty
-
first
V first()
Returns the head element ornull
if this sorted set is empty.- Returns:
- the head element or
null
if this sorted set is empty
-
last
V last()
Returns the tail element ornull
if this sorted set is empty.- Returns:
- the tail element or
null
if this sorted set is empty
-
firstScore
Double firstScore()
Returns score of the tail element or returnsnull
if this sorted set is empty.- Returns:
- the tail element or
null
if this sorted set is empty
-
lastScore
Double lastScore()
Returns score of the head element or returnsnull
if this sorted set is empty.- Returns:
- the tail element or
null
if this sorted set is empty
-
removeRangeByScore
int removeRangeByScore(double startScore, boolean startScoreInclusive, double endScore, boolean endScoreInclusive)
-
removeRangeByRank
int removeRangeByRank(int startIndex, int endIndex)
-
rank
Integer rank(V o)
Returns rank of value, with the scores ordered from low to high.- Parameters:
o
- - object- Returns:
- rank or
null
if value does not exist
-
revRank
Integer revRank(V o)
Returns rank of value, with the scores ordered from high to low.- Parameters:
o
- - object- Returns:
- rank or
null
if value does not exist
-
getScore
Double getScore(V o)
Returns score of element ornull
if it doesn't exist.- Parameters:
o
- - element- Returns:
- score
-
add
boolean add(double score, V object)
Adds element to this set, overrides previous score if it has been already added.- Parameters:
score
- - object scoreobject
- - object itself- Returns:
true
if element has added andfalse
if not.
-
addAndGetRank
Integer addAndGetRank(double score, V object)
Adds element to this set, overrides previous score if it has been already added. Finally return the rank of the item- Parameters:
score
- - object scoreobject
- - object itself- Returns:
- rank
-
addAndGetRevRank
Integer addAndGetRevRank(double score, V object)
Adds element to this set, overrides previous score if it has been already added. Finally return the reverse rank of the item- Parameters:
score
- - object scoreobject
- - object itself- Returns:
- reverse rank
-
tryAdd
boolean tryAdd(double score, V object)
Adds element to this set only if has not been added before.Works only with Redis 3.0.2 and higher.
- Parameters:
score
- - object scoreobject
- - object itself- Returns:
true
if element has added andfalse
if not.
-
size
int size()
Returns size of this set.- Returns:
- size
-
isEmpty
boolean isEmpty()
Returnstrue
if this set is empty- Returns:
true
if empty
-
iterator
Iterator<V> iterator(String pattern)
Returns an iterator over elements in this set. Ifpattern
is not null then only elements match this pattern are loaded.- Parameters:
pattern
- - search pattern- Returns:
- iterator
-
iterator
Iterator<V> iterator(int count)
Returns an iterator over elements in this set. Elements are loaded in batch. Batch size is defined bycount
param.- Parameters:
count
- - size of elements batch- Returns:
- iterator
-
iterator
Iterator<V> iterator(String pattern, int count)
Returns an iterator over elements in this set. Elements are loaded in batch. Batch size is defined bycount
param. If pattern is not null then only elements match this pattern are loaded.- Parameters:
pattern
- - search patterncount
- - size of elements batch- Returns:
- iterator
-
contains
boolean contains(Object o)
-
toArray
Object[] toArray()
-
toArray
<T> T[] toArray(T[] a)
-
remove
boolean remove(Object o)
-
containsAll
boolean containsAll(Collection<?> c)
-
removeAll
boolean removeAll(Collection<?> c)
-
retainAll
boolean retainAll(Collection<?> c)
-
clear
void clear()
-
addScoreAndGetRank
Integer addScoreAndGetRank(V object, Number value)
Adds score to element and returns its rank- Parameters:
object
- - object itselfvalue
- - object score- Returns:
- rank
-
addScoreAndGetRevRank
Integer addScoreAndGetRevRank(V object, Number value)
Adds score to element and returns its reverse rank- Parameters:
object
- - object itselfvalue
- - object score- Returns:
- reverse rank
-
valueRange
Collection<V> valueRange(int startIndex, int endIndex)
-
valueRangeReversed
Collection<V> valueRangeReversed(int startIndex, int endIndex)
-
entryRange
Collection<ScoredEntry<V>> entryRange(int startIndex, int endIndex)
-
entryRangeReversed
Collection<ScoredEntry<V>> entryRangeReversed(int startIndex, int endIndex)
-
valueRange
Collection<V> valueRange(double startScore, boolean startScoreInclusive, double endScore, boolean endScoreInclusive)
Returns all values betweenstartScore
andendScore
.- Parameters:
startScore
- - start score. UseDouble.POSITIVE_INFINITY
orDouble.NEGATIVE_INFINITY
to define infinity numbersstartScoreInclusive
- - start score inclusiveendScore
- - end score UseDouble.POSITIVE_INFINITY
orDouble.NEGATIVE_INFINITY
to define infinity numbersendScoreInclusive
- - end score inclusive- Returns:
- values
-
valueRangeReversed
Collection<V> valueRangeReversed(double startScore, boolean startScoreInclusive, double endScore, boolean endScoreInclusive)
Returns all values betweenstartScore
andendScore
in reversed order.- Parameters:
startScore
- - start score. UseDouble.POSITIVE_INFINITY
orDouble.NEGATIVE_INFINITY
to define infinity numbersstartScoreInclusive
- - start score inclusiveendScore
- - end score UseDouble.POSITIVE_INFINITY
orDouble.NEGATIVE_INFINITY
to define infinity numbersendScoreInclusive
- - end score inclusive- Returns:
- values
-
entryRange
Collection<ScoredEntry<V>> entryRange(double startScore, boolean startScoreInclusive, double endScore, boolean endScoreInclusive)
-
valueRange
Collection<V> valueRange(double startScore, boolean startScoreInclusive, double endScore, boolean endScoreInclusive, int offset, int count)
-
valueRangeReversed
Collection<V> valueRangeReversed(double startScore, boolean startScoreInclusive, double endScore, boolean endScoreInclusive, int offset, int count)
-
entryRange
Collection<ScoredEntry<V>> entryRange(double startScore, boolean startScoreInclusive, double endScore, boolean endScoreInclusive, int offset, int count)
-
entryRangeReversed
Collection<ScoredEntry<V>> entryRangeReversed(double startScore, boolean startScoreInclusive, double endScore, boolean endScoreInclusive)
-
entryRangeReversed
Collection<ScoredEntry<V>> entryRangeReversed(double startScore, boolean startScoreInclusive, double endScore, boolean endScoreInclusive, int offset, int count)
-
count
Long count(double startScore, boolean startScoreInclusive, double endScore, boolean endScoreInclusive)
Returns the number of elements with a score betweenstartScore
andendScore
.- Parameters:
startScore
- - start scorestartScoreInclusive
- - start score inclusiveendScore
- - end scoreendScoreInclusive
- - end score inclusive- Returns:
- count of elements
-
readAll
Collection<V> readAll()
Read all values at once.- Returns:
- values
-
intersection
int intersection(String... names)
Intersect provided ScoredSortedSets and store result to current ScoredSortedSet- Parameters:
names
- - names of ScoredSortedSet- Returns:
- length of intersection
-
intersection
int intersection(RScoredSortedSet.Aggregate aggregate, String... names)
Intersect provided ScoredSortedSets with defined aggregation method and store result to current ScoredSortedSet- Parameters:
aggregate
- - score aggregation modenames
- - names of ScoredSortedSet- Returns:
- length of intersection
-
intersection
int intersection(Map<String,Double> nameWithWeight)
Intersect provided ScoredSortedSets mapped to weight multiplier and store result to current ScoredSortedSet- Parameters:
nameWithWeight
- - name of ScoredSortedSet mapped to weight multiplier- Returns:
- length of intersection
-
intersection
int intersection(RScoredSortedSet.Aggregate aggregate, Map<String,Double> nameWithWeight)
Intersect provided ScoredSortedSets mapped to weight multiplier with defined aggregation method and store result to current ScoredSortedSet- Parameters:
aggregate
- - score aggregation modenameWithWeight
- - name of ScoredSortedSet mapped to weight multiplier- Returns:
- length of intersection
-
union
int union(String... names)
Union provided ScoredSortedSets and store result to current ScoredSortedSet- Parameters:
names
- - names of ScoredSortedSet- Returns:
- length of union
-
union
int union(RScoredSortedSet.Aggregate aggregate, String... names)
Union provided ScoredSortedSets with defined aggregation method and store result to current ScoredSortedSet- Parameters:
aggregate
- - score aggregation modenames
- - names of ScoredSortedSet- Returns:
- length of union
-
union
int union(Map<String,Double> nameWithWeight)
Union provided ScoredSortedSets mapped to weight multiplier and store result to current ScoredSortedSet- Parameters:
nameWithWeight
- - name of ScoredSortedSet mapped to weight multiplier- Returns:
- length of union
-
union
int union(RScoredSortedSet.Aggregate aggregate, Map<String,Double> nameWithWeight)
Union provided ScoredSortedSets mapped to weight multiplier with defined aggregation method and store result to current ScoredSortedSet- Parameters:
aggregate
- - score aggregation modenameWithWeight
- - name of ScoredSortedSet mapped to weight multiplier- Returns:
- length of union
-
-