Package org.infinispan.multimap.impl
Class EmbeddedMultimapSortedSetCache<K,V>
java.lang.Object
org.infinispan.multimap.impl.EmbeddedMultimapSortedSetCache<K,V>
Multimap with Sorted Map Implementation methods
- Since:
- 15.0
- Author:
- Katia Aresti
-
Field Summary
Modifier and TypeFieldDescriptionprotected final AdvancedCache
<K, SortedSetBucket<V>> protected final InternalEntryFactory
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
protected final FunctionalMap.ReadWriteMap
<K, SortedSetBucket<V>> -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionaddMany
(K key, Collection<ScoredValue<V>> scoredValues, SortedSetAddArgs args) Adds and/or updates, depending on the provided options, the value and the associated score.Counts the number of elements between the given min and max scores.Counts the number of elements between the given min and max scores.Get the value as a collectionReturns the sorted set value if such exists.getValueAsList
(K key) Returns the sorted set value if such exists.CompletionStage
<Set<org.infinispan.multimap.impl.internal.MultimapObjectWrapper<V>>> getValuesSet
(K key) Returns the set values if such exists.incrementScore
(K key, double score, V member, SortedSetAddArgs args) Returns the index of member in the sorted set, with the scores ordered from high to low.inter
(K key, Collection<ScoredValue<V>> scoredValues, double weight, SortedSetBucket.AggregateFunction aggFunction) Computes the intersection of the collection and the given sorted sets key, if such exist.Pops the number of elements provided by the count parameter.randomMembers
(K key, int count) If the count argument is positive, return an array of distinct elements.Removes elements from a range of scores.Removes range from index from to index to.Removes the given elements from the sorted set, if such exist.When the elements have the same score, removes elements from a range of elements ordered by elements natural ordering.Returns the score of member in the sorted.Returns the scores of members in the sorted.Retieves the size of the sorted set valuesubsetByIndex
(K key, SortedSetSubsetArgs<Long> args) Subset elements in the sorted set by index.subsetByLex
(K key, SortedSetSubsetArgs<V> args) Subset elements using the natural ordering of the values.subsetByScore
(K key, SortedSetSubsetArgs<Double> args) Subset elements using the score.union
(K key, Collection<ScoredValue<V>> scoredValues, double weight, SortedSetBucket.AggregateFunction aggFunction) Computes the union of the collection and the given sorted sets key, if such exist.
-
Field Details
-
ERR_KEY_CAN_T_BE_NULL
- See Also:
-
ERR_MIN_CAN_T_BE_NULL
- See Also:
-
ERR_MAX_CAN_T_BE_NULL
- See Also:
-
ERR_MEMBER_CAN_T_BE_NULL
- See Also:
-
ERR_ARGS_CAN_T_BE_NULL
- See Also:
-
ERR_ARGS_INDEXES_CAN_T_BE_NULL
- See Also:
-
ERR_MEMBERS_CAN_T_BE_NULL
- See Also:
-
ERR_SCORES_CAN_T_BE_NULL
- See Also:
-
readWriteMap
-
cache
-
entryFactory
-
-
Constructor Details
-
EmbeddedMultimapSortedSetCache
-
-
Method Details
-
addMany
public CompletionStage<Long> addMany(K key, Collection<ScoredValue<V>> scoredValues, SortedSetAddArgs args) Adds and/or updates, depending on the provided options, the value and the associated score.- Parameters:
key
- , the name of the sorted setscoredValues
- , scores and values pair list to be addedargs
- to provide different options: addOnly -> adds new elements only, ignore existing ones. updateOnly -> updates existing elements only, ignore new elements. updateLessScoresOnly -> creates new elements and updates existing elements if the score is less than current score. updateGreaterScoresOnly -> creates new elements and updates existing elements if the score is greater than current score. returnChangedCount -> by default returns number of new added elements. If true, counts created and updated elements.- Returns:
CompletionStage
containing the number of entries added and/or updated depending on the provided arguments
-
incrementScore
-
size
Retieves the size of the sorted set value- Parameters:
key
- , the name of the sorted set- Returns:
- , the size
-
get
Get the value as a collection- Parameters:
key
- , the name of the list- Returns:
- the collection with values if such exist, or an empty collection if the key is not present
-
getEntry
-
getValue
Returns the sorted set value if such exists.- Parameters:
key
- , the name of the sorted set- Returns:
- the value of the Sorted Set
-
getValueAsList
Returns the sorted set value if such exists.- Parameters:
key
- , the name of the sorted set- Returns:
- the value of the Sorted Set
-
getValuesSet
public CompletionStage<Set<org.infinispan.multimap.impl.internal.MultimapObjectWrapper<V>>> getValuesSet(K key) Returns the set values if such exists.- Parameters:
key
- , the name of the sorted set- Returns:
- the values in the sorted set as a set
-
count
public CompletionStage<Long> count(K key, double min, boolean includeMin, double max, boolean includeMax) Counts the number of elements between the given min and max scores.- Parameters:
key
- , the name of the sorted setmin
- , the min scoreincludeMin
- , include elements with the min score in the countmax
- , the max scoreincludeMax
- , include elements with the max score in the count- Returns:
- the number of elements in between min and max scores
-
count
Counts the number of elements between the given min and max scores.- Parameters:
key
- , the name of the sorted setmin
- , the min valueincludeMin
- , include elements with the min value in the countmax
- , the max valueincludeMax
- , include elements with the max value in the count- Returns:
- the number of elements in between min and max values
-
pop
Pops the number of elements provided by the count parameter. Elements are pop from the head or the tail, depending on the min parameter.- Parameters:
key
- , the sorted set namemin
- , if true pops lower scores, if false pops higher scorescount
- , number of values- Returns:
- , empty if the sorted set does not exist
-
score
Returns the score of member in the sorted.- Parameters:
key
- , the name of the sorted setmember
- , the score value to be retrieved- Returns:
CompletionStage
with the score, or null if the score of the member does not exist.
-
scores
Returns the scores of members in the sorted.- Parameters:
key
- , the name of the sorted setmembers
- , the scores to be retrieved- Returns:
CompletionStage
with the list of the scores, with null values if the score does not exist.
-
subsetByIndex
public CompletionStage<Collection<ScoredValue<V>>> subsetByIndex(K key, SortedSetSubsetArgs<Long> args) Subset elements in the sorted set by index. Indexes can be explained as negative numbers. Subset can be reversed, depending on args.- Parameters:
key
- , the name of the sorted setargs
- , options for the operation- Returns:
- resulting collection
-
subsetByScore
public CompletionStage<Collection<ScoredValue<V>>> subsetByScore(K key, SortedSetSubsetArgs<Double> args) Subset elements using the score. Subset can be reversed, depending on args.- Parameters:
key
- , the name of the sorted setargs
- , options for the operation- Returns:
- resulting collection
-
subsetByLex
Subset elements using the natural ordering of the values. All the elements in the sorted set must have the same score, so they are ordered by natural ordering. Subset can be reversed, depending on args.- Parameters:
key
- , the name of the sorted setargs
- , options for the operation- Returns:
- resulting collection
-
indexOf
Returns the index of member in the sorted set, with the scores ordered from high to low. Index is 0-based. When isRev is false, the member with the lowest score has index 0. When isRev is true, the member with the highest score has index 0- Parameters:
key
- , the name of the sorted setmember
- , the member to be foundisRev
- , perform the operation in reverse order- Returns:
- the index of the member and the score
-
union
public CompletionStage<Collection<ScoredValue<V>>> union(K key, Collection<ScoredValue<V>> scoredValues, double weight, SortedSetBucket.AggregateFunction aggFunction) Computes the union of the collection and the given sorted sets key, if such exist.- Parameters:
key
- , the name of the sorted setscoredValues
- , collection of scored valuesweight
- , specify a multiplication factor for each input sorted set. Every element in the sorted set is multiplied by this factor.aggFunction
- , how the results of the union are aggregated. Defaults to SUM.- Returns:
- , union collection, sorted by score
-
inter
public CompletionStage<Collection<ScoredValue<V>>> inter(K key, Collection<ScoredValue<V>> scoredValues, double weight, SortedSetBucket.AggregateFunction aggFunction) Computes the intersection of the collection and the given sorted sets key, if such exist.- Parameters:
key
- , the name of the sorted setscoredValues
- , collection of scored valuesweight
- , specify a multiplication factor for each input sorted set. Every element in the sorted set is multiplied by this factor.aggFunction
- , how the results of the union are aggregated. Defaults to SUM.- Returns:
- , intersected collection, sorted by score
-
removeAll
Removes the given elements from the sorted set, if such exist.- Parameters:
key
- , the name of the sorted setmembers
- , members to be removed- Returns:
- removed members count
-
removeAll
Removes range from index from to index to.- Parameters:
key
- , the name of the sorted setmin
- , index from. Index can't be null and must be providedmax
- , index to. Index can't be null and must be provided- Returns:
- long representing the number of members removed
-
removeAll
public CompletionStage<Long> removeAll(K key, Double min, boolean includeMin, Double max, boolean includeMax) Removes elements from a range of scores.- Parameters:
key
- , the sorted set namemin
- , smallest score value to be removed. If null, removes from the head of the sorted setincludeMin
- , indicates if the min score is included in the remove rangemax
- , greatest score value to be removed. If null, removes to the tail of the sorted setincludeMax
- , indicates if the max score is included in the remove range- Returns:
- the number of removed elements
-
removeAll
When the elements have the same score, removes elements from a range of elements ordered by elements natural ordering.- Parameters:
key
- , the sorted set namemin
- , smallest element to be removed. If null, removes from the head of the sorted setincludeMin
- , indicates if the smallest element is included in the remove rangemax
- , greatest element to be removed. If null, removes to the tail of the sorted setincludeMax
- , indicates if the greater element is included in the remove range- Returns:
- the number of removed elements
-
randomMembers
If the count argument is positive, return an array of distinct elements. The If the count argument is negative, it is allowed to return the same element multiple times. In this case, the number of returned elements is the absolute value of the specified count.- Parameters:
key
- , the sorted set namecount
- , number of random members to retrieve- Returns:
- , collection of the random scored entries
-