Interface RScoredSortedSet<V>

    • Method Detail

      • mapReduce

        <KOut,​VOut> RCollectionMapReduce<V,​KOut,​VOut> mapReduce()
        Returns RMapReduce object associated with this object
        Type Parameters:
        KOut - output key
        VOut - 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 queue
        timeout - how long to wait before giving up, in units of unit
        unit - a TimeUnit determining how to interpret the timeout 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 queue
        timeout - how long to wait before giving up, in units of unit
        unit - a TimeUnit determining how to interpret the timeout 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 or null if this sorted set is empty.
        Parameters:
        timeout - how long to wait before giving up, in units of unit
        unit - a TimeUnit determining how to interpret the timeout 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 or null if this sorted set is empty.
        Parameters:
        timeout - how long to wait before giving up, in units of unit
        unit - a TimeUnit determining how to interpret the timeout 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 or null 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 or null 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 or null 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 or null 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 or null 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 or null 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 returns null 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 returns null 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 or null 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 score
        object - - object itself
        Returns:
        true if element has added and false 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 score
        object - - 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 score
        object - - 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 score
        object - - object itself
        Returns:
        true if element has added and false if not.
      • size

        int size()
        Returns size of this set.
        Returns:
        size
      • isEmpty

        boolean isEmpty()
        Returns true if this set is empty
        Returns:
        true if empty
      • iterator

        Iterator<V> iterator​(String pattern)
        Returns an iterator over elements in this set. If pattern 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 by count 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 by count param. If pattern is not null then only elements match this pattern are loaded.
        Parameters:
        pattern - - search pattern
        count - - size of elements batch
        Returns:
        iterator
      • contains

        boolean contains​(Object o)
      • 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 itself
        value - - object score
        Returns:
        rank
      • addScoreAndGetRevRank

        Integer addScoreAndGetRevRank​(V object,
                                      Number value)
        Adds score to element and returns its reverse rank
        Parameters:
        object - - object itself
        value - - object score
        Returns:
        reverse rank
      • valueRange

        Collection<V> valueRange​(int startIndex,
                                 int endIndex)
      • valueRangeReversed

        Collection<V> valueRangeReversed​(int startIndex,
                                         int endIndex)
      • valueRange

        Collection<V> valueRange​(double startScore,
                                 boolean startScoreInclusive,
                                 double endScore,
                                 boolean endScoreInclusive)
        Returns all values between startScore and endScore.
        Parameters:
        startScore - - start score. Use Double.POSITIVE_INFINITY or Double.NEGATIVE_INFINITY to define infinity numbers
        startScoreInclusive - - start score inclusive
        endScore - - end score Use Double.POSITIVE_INFINITY or Double.NEGATIVE_INFINITY to define infinity numbers
        endScoreInclusive - - end score inclusive
        Returns:
        values
      • valueRangeReversed

        Collection<V> valueRangeReversed​(double startScore,
                                         boolean startScoreInclusive,
                                         double endScore,
                                         boolean endScoreInclusive)
        Returns all values between startScore and endScore in reversed order.
        Parameters:
        startScore - - start score. Use Double.POSITIVE_INFINITY or Double.NEGATIVE_INFINITY to define infinity numbers
        startScoreInclusive - - start score inclusive
        endScore - - end score Use Double.POSITIVE_INFINITY or Double.NEGATIVE_INFINITY to define infinity numbers
        endScoreInclusive - - 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 between startScore and endScore.
        Parameters:
        startScore - - start score
        startScoreInclusive - - start score inclusive
        endScore - - end score
        endScoreInclusive - - 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 mode
        names - - 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 mode
        nameWithWeight - - 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 mode
        names - - 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 mode
        nameWithWeight - - name of ScoredSortedSet mapped to weight multiplier
        Returns:
        length of union