Interface RSet<V>

    • Method Detail

      • addAllCounted

        int addAllCounted​(Collection<? extends V> c)
        Adds all elements contained in the specified collection. Returns number of added elements.
        Parameters:
        c - - collection of elements to add
        Returns:
        number of added elements
      • removeAllCounted

        int removeAllCounted​(Collection<? extends V> c)
        Removes all elements contained in the specified collection. Returns number of removed elements.
        Parameters:
        c - - collection of elements to add
        Returns:
        number of removed elements
      • getCountDownLatch

        RCountDownLatch getCountDownLatch​(V value)
        Returns RCountDownLatch instance associated with value
        Parameters:
        value - - set value
        Returns:
        RCountDownLatch object
      • getPermitExpirableSemaphore

        RPermitExpirableSemaphore getPermitExpirableSemaphore​(V value)
        Returns RPermitExpirableSemaphore instance associated with value
        Parameters:
        value - - set value
        Returns:
        RPermitExpirableSemaphore object
      • getSemaphore

        RSemaphore getSemaphore​(V value)
        Returns RSemaphore instance associated with value
        Parameters:
        value - - set value
        Returns:
        RSemaphore object
      • getFairLock

        RLock getFairLock​(V value)
        Returns RLock instance associated with value
        Parameters:
        value - - set value
        Returns:
        RLock object
      • getReadWriteLock

        RReadWriteLock getReadWriteLock​(V value)
        Returns RReadWriteLock instance associated with value
        Parameters:
        value - - set value
        Returns:
        RReadWriteLock object
      • getLock

        RLock getLock​(V value)
        Returns lock instance associated with value
        Parameters:
        value - - set value
        Returns:
        RLock object
      • stream

        Stream<V> stream​(int count)
        Returns stream of elements fetches elements in a batch. Batch size is defined by count param.
        Parameters:
        count - - size of elements batch
        Returns:
        stream of elements
      • stream

        Stream<V> stream​(String pattern,
                         int count)
        Returns stream of elements fetches elements in a 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:
        stream of elements
      • stream

        Stream<V> stream​(String pattern)
        Returns stream of elements. If pattern is not null then only elements match this pattern are loaded.
        Parameters:
        pattern - - search pattern
        Returns:
        stream of elements
      • iterator

        Iterator<V> iterator​(int count)
        Returns elements iterator fetches elements in a 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 elements iterator fetches elements in a 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
      • iterator

        Iterator<V> iterator​(String pattern)
        Returns elements iterator. If pattern is not null then only elements match this pattern are loaded.
        Parameters:
        pattern - - search pattern
        Returns:
        iterator
      • distributedIterator

        Iterator<V> distributedIterator​(int count)
        Returns element iterator that can be shared across multiple applications. Creating multiple iterators on the same object with this method will result in a single shared iterator. See distributedIterator(String, String, int) for creating different iterators.
        Parameters:
        count - batch size
        Returns:
        shared elements iterator
      • distributedIterator

        Iterator<V> distributedIterator​(String pattern)
        Returns iterator over elements that match specified pattern. Iterator can be shared across multiple applications. Creating multiple iterators on the same object with this method will result in a single shared iterator. See distributedIterator(String, String, int) for creating different iterators.
        Parameters:
        pattern - element pattern
        Returns:
        shared elements iterator
      • distributedIterator

        Iterator<V> distributedIterator​(String iteratorName,
                                        String pattern,
                                        int count)
        Returns iterator over elements that match specified pattern. Iterator can be shared across multiple applications. Creating multiple iterators on the same object with this method will result in a single shared iterator. Iterator name must be resolved to the same hash slot as set name.
        Parameters:
        pattern - element pattern
        count - batch size
        iteratorName - redis object name to which cursor will be saved
        Returns:
        shared elements iterator
      • 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
      • removeRandom

        Set<V> removeRandom​(int amount)
        Removes and returns random elements limited by amount
        Parameters:
        amount - of random elements
        Returns:
        random elements
      • removeRandom

        V removeRandom()
        Removes and returns random element
        Returns:
        random element
      • random

        V random()
        Returns random element
        Returns:
        random element
      • random

        Set<V> random​(int count)
        Returns random elements from set limited by count
        Parameters:
        count - - values amount to return
        Returns:
        random elements
      • move

        boolean move​(String destination,
                     V member)
        Move a member from this set to the given destination set in.
        Parameters:
        destination - the destination set
        member - the member to move
        Returns:
        true if the element is moved, false if the element is not a member of this set or no operation was performed
      • readAll

        Set<V> readAll()
        Read all elements at once
        Returns:
        values
      • union

        int union​(String... names)
        Union sets specified by name and write to current set. If current set already exists, it is overwritten.
        Parameters:
        names - - name of sets
        Returns:
        size of union
      • readUnion

        Set<V> readUnion​(String... names)
        Union sets specified by name with current set without current set state change.
        Parameters:
        names - - name of sets
        Returns:
        values
      • diff

        int diff​(String... names)
        Diff sets specified by name and write to current set. If current set already exists, it is overwritten.
        Parameters:
        names - - name of sets
        Returns:
        values
      • readDiff

        Set<V> readDiff​(String... names)
        Diff sets specified by name with current set. Without current set state change.
        Parameters:
        names - - name of sets
        Returns:
        values
      • intersection

        int intersection​(String... names)
        Intersection sets specified by name and write to current set. If current set already exists, it is overwritten.
        Parameters:
        names - - name of sets
        Returns:
        size of intersection
      • readIntersection

        Set<V> readIntersection​(String... names)
        Intersection sets specified by name with current set without current set state change.
        Parameters:
        names - - name of sets
        Returns:
        values
      • countIntersection

        Integer countIntersection​(String... names)
        Counts elements of set as a result of sets intersection with current set.

        Requires Redis 7.0.0 and higher.

        Parameters:
        names - - name of sets
        Returns:
        amount of elements
      • countIntersection

        Integer countIntersection​(int limit,
                                  String... names)
        Counts elements of set as a result of sets intersection with current set.

        Requires Redis 7.0.0 and higher.

        Parameters:
        names - - name of sets
        limit - - sets intersection limit
        Returns:
        amount of elements
      • tryAdd

        boolean tryAdd​(V... values)
        Tries to add elements only if none of them in set.
        Parameters:
        values - - values to add
        Returns:
        true if elements successfully added, otherwise false.