Class EmbeddedMultimapSortedSetCache<K,V>

java.lang.Object
org.infinispan.multimap.impl.EmbeddedMultimapSortedSetCache<K,V>

public class EmbeddedMultimapSortedSetCache<K,V> extends Object
Multimap with Sorted Map Implementation methods
Since:
15.0
Author:
Katia Aresti
  • Field Details

  • Constructor Details

  • 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 set
      scoredValues - , scores and values pair list to be added
      args - 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

      public CompletionStage<Double> incrementScore(K key, double score, V member, SortedSetAddArgs args)
    • size

      public CompletionStage<Long> size(K key)
      Retieves the size of the sorted set value
      Parameters:
      key - , the name of the sorted set
      Returns:
      , the size
    • get

      public CompletionStage<Collection<ScoredValue<V>>> get(K key)
      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

      public CompletionStage<CacheEntry<K,Collection<ScoredValue<V>>>> getEntry(K key)
    • getValue

      public CompletionStage<SortedSet<ScoredValue<V>>> getValue(K key)
      Returns the sorted set value if such exists.
      Parameters:
      key - , the name of the sorted set
      Returns:
      the value of the Sorted Set
    • getValueAsList

      public CompletionStage<List<ScoredValue<V>>> getValueAsList(K key)
      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 set
      min - , the min score
      includeMin - , include elements with the min score in the count
      max - , the max score
      includeMax - , include elements with the max score in the count
      Returns:
      the number of elements in between min and max scores
    • count

      public CompletionStage<Long> count(K key, V min, boolean includeMin, V max, boolean includeMax)
      Counts the number of elements between the given min and max scores.
      Parameters:
      key - , the name of the sorted set
      min - , the min value
      includeMin - , include elements with the min value in the count
      max - , the max value
      includeMax - , include elements with the max value in the count
      Returns:
      the number of elements in between min and max values
    • pop

      public CompletionStage<Collection<ScoredValue<V>>> pop(K key, boolean min, long count)
      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 name
      min - , if true pops lower scores, if false pops higher scores
      count - , number of values
      Returns:
      , empty if the sorted set does not exist
    • score

      public CompletionStage<Double> score(K key, V member)
      Returns the score of member in the sorted.
      Parameters:
      key - , the name of the sorted set
      member - , the score value to be retrieved
      Returns:
      CompletionStage with the score, or null if the score of the member does not exist.
    • scores

      public CompletionStage<List<Double>> scores(K key, List<V> members)
      Returns the scores of members in the sorted.
      Parameters:
      key - , the name of the sorted set
      members - , 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 set
      args - , 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 set
      args - , options for the operation
      Returns:
      resulting collection
    • subsetByLex

      public CompletionStage<Collection<ScoredValue<V>>> subsetByLex(K key, SortedSetSubsetArgs<V> args)
      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 set
      args - , options for the operation
      Returns:
      resulting collection
    • indexOf

      public CompletionStage<SortedSetBucket.IndexValue> indexOf(K key, V member, boolean isRev)
      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 set
      member - , the member to be found
      isRev - , 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 set
      scoredValues - , collection of scored values
      weight - , 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 set
      scoredValues - , collection of scored values
      weight - , 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

      public CompletionStage<Long> removeAll(K key, List<V> members)
      Removes the given elements from the sorted set, if such exist.
      Parameters:
      key - , the name of the sorted set
      members - , members to be removed
      Returns:
      removed members count
    • removeAll

      public CompletionStage<Long> removeAll(K key, Long min, Long max)
      Removes range from index from to index to.
      Parameters:
      key - , the name of the sorted set
      min - , index from. Index can't be null and must be provided
      max - , 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 name
      min - , smallest score value to be removed. If null, removes from the head of the sorted set
      includeMin - , indicates if the min score is included in the remove range
      max - , greatest score value to be removed. If null, removes to the tail of the sorted set
      includeMax - , indicates if the max score is included in the remove range
      Returns:
      the number of removed elements
    • removeAll

      public CompletionStage<Long> removeAll(K key, V min, boolean includeMin, V max, boolean includeMax)
      When the elements have the same score, removes elements from a range of elements ordered by elements natural ordering.
      Parameters:
      key - , the sorted set name
      min - , smallest element to be removed. If null, removes from the head of the sorted set
      includeMin - , indicates if the smallest element is included in the remove range
      max - , greatest element to be removed. If null, removes to the tail of the sorted set
      includeMax - , indicates if the greater element is included in the remove range
      Returns:
      the number of removed elements
    • randomMembers

      public CompletionStage<List<ScoredValue<V>>> randomMembers(K key, int count)
      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 name
      count - , number of random members to retrieve
      Returns:
      , collection of the random scored entries