Interface ReactiveSetOperations<K,V>


public interface ReactiveSetOperations<K,V>
Reactive Redis operations for Set Commands.

Streams of methods returning Mono<K> or Flux<M> are terminated with InvalidDataAccessApiUsageException when RedisElementReader.read(ByteBuffer) returns null for a particular element as Reactive Streams prohibit the usage of null values.

Since:
2.0
Author:
Mark Paluch, Christoph Strobl, Roman Bezpalko
See Also:
  • Method Details

    • add

      Mono<Long> add(K key, V... values)
      Add given values to set at key.
      Parameters:
      key - must not be null.
      values -
      Returns:
      See Also:
    • remove

      Mono<Long> remove(K key, Object... values)
      Remove given values from set at key and return the number of removed elements.
      Parameters:
      key - must not be null.
      values -
      Returns:
      See Also:
    • pop

      Mono<V> pop(K key)
      Remove and return a random member from set at key.
      Parameters:
      key - must not be null.
      Returns:
      See Also:
    • pop

      Flux<V> pop(K key, long count)
      Remove and return count random members from set at key.
      Parameters:
      key - must not be null.
      count - number of random members to pop from the set.
      Returns:
      Flux emitting random members.
      See Also:
    • move

      Mono<Boolean> move(K sourceKey, V value, K destKey)
      Move value from key to destKey
      Parameters:
      sourceKey - must not be null.
      value -
      destKey - must not be null.
      Returns:
      See Also:
    • size

      Mono<Long> size(K key)
      Get size of set at key.
      Parameters:
      key - must not be null.
      Returns:
      See Also:
    • isMember

      Mono<Boolean> isMember(K key, Object o)
      Check if set at key contains value.
      Parameters:
      key - must not be null.
      o -
      Returns:
      See Also:
    • isMember

      Mono<Map<Object,Boolean>> isMember(K key, Object... objects)
      Check if set at key contains one or more values.
      Parameters:
      key - must not be null.
      objects -
      Returns:
      Since:
      2.6
      See Also:
    • intersect

      Flux<V> intersect(K key, K otherKey)
      Returns the members intersecting all given sets at key and otherKey.
      Parameters:
      key - must not be null.
      otherKey - must not be null.
      Returns:
      See Also:
    • intersect

      Flux<V> intersect(K key, Collection<K> otherKeys)
      Returns the members intersecting all given sets at key and otherKeys.
      Parameters:
      key - must not be null.
      otherKeys - must not be null.
      Returns:
      See Also:
    • intersect

      Flux<V> intersect(Collection<K> keys)
      Returns the members intersecting all given sets at keys.
      Parameters:
      keys - must not be null.
      Returns:
      Since:
      2.2
      See Also:
    • intersectAndStore

      Mono<Long> intersectAndStore(K key, K otherKey, K destKey)
      Intersect all given sets at key and otherKey and store result in destKey.
      Parameters:
      key - must not be null.
      otherKey - must not be null.
      destKey - must not be null.
      Returns:
      See Also:
    • intersectAndStore

      Mono<Long> intersectAndStore(K key, Collection<K> otherKeys, K destKey)
      Intersect all given sets at key and otherKeys and store result in destKey.
      Parameters:
      key - must not be null.
      otherKeys - must not be null.
      destKey - must not be null.
      Returns:
      See Also:
    • intersectAndStore

      Mono<Long> intersectAndStore(Collection<K> keys, K destKey)
      Intersect all given sets at keys and store result in destKey.
      Parameters:
      keys - must not be null.
      destKey - must not be null.
      Returns:
      Since:
      2.2
      See Also:
    • union

      Flux<V> union(K key, K otherKey)
      Union all sets at given keys and otherKey.
      Parameters:
      key - must not be null.
      otherKey - must not be null.
      Returns:
      See Also:
    • union

      Flux<V> union(K key, Collection<K> otherKeys)
      Union all sets at given keys and otherKeys.
      Parameters:
      key - must not be null.
      otherKeys - must not be null.
      Returns:
      See Also:
    • union

      Flux<V> union(Collection<K> keys)
      Union all sets at given keys.
      Parameters:
      keys - must not be null.
      Returns:
      Since:
      2.2
      See Also:
    • unionAndStore

      Mono<Long> unionAndStore(K key, K otherKey, K destKey)
      Union all sets at given key and otherKey and store result in destKey.
      Parameters:
      key - must not be null.
      otherKey - must not be null.
      destKey - must not be null.
      Returns:
      See Also:
    • unionAndStore

      Mono<Long> unionAndStore(K key, Collection<K> otherKeys, K destKey)
      Union all sets at given key and otherKeys and store result in destKey.
      Parameters:
      key - must not be null.
      otherKeys - must not be null.
      destKey - must not be null.
      Returns:
      See Also:
    • unionAndStore

      Mono<Long> unionAndStore(Collection<K> keys, K destKey)
      Union all sets at given keys and store result in destKey.
      Parameters:
      keys - must not be null.
      destKey - must not be null.
      Returns:
      Since:
      2.2
      See Also:
    • difference

      Flux<V> difference(K key, K otherKey)
      Diff all sets for given key and otherKey.
      Parameters:
      key - must not be null.
      otherKey - must not be null.
      Returns:
      See Also:
    • difference

      Flux<V> difference(K key, Collection<K> otherKeys)
      Diff all sets for given key and otherKeys.
      Parameters:
      key - must not be null.
      otherKeys - must not be null.
      Returns:
      See Also:
    • difference

      Flux<V> difference(Collection<K> keys)
      Diff all sets for given keys.
      Parameters:
      keys - must not be null.
      Returns:
      Since:
      2.2
      See Also:
    • differenceAndStore

      Mono<Long> differenceAndStore(K key, K otherKey, K destKey)
      Diff all sets for given key and otherKey and store result in destKey.
      Parameters:
      key - must not be null.
      otherKey - must not be null.
      destKey - must not be null.
      Returns:
      See Also:
    • differenceAndStore

      Mono<Long> differenceAndStore(K key, Collection<K> otherKeys, K destKey)
      Diff all sets for given key and otherKeys and store result in destKey.
      Parameters:
      key - must not be null.
      otherKeys - must not be null.
      destKey - must not be null.
      Returns:
      See Also:
    • differenceAndStore

      Mono<Long> differenceAndStore(Collection<K> keys, K destKey)
      Diff all sets for given keys and store result in destKey.
      Parameters:
      keys - must not be null.
      destKey - must not be null.
      Returns:
      Since:
      2.2
      See Also:
    • members

      Flux<V> members(K key)
      Get all elements of set at key.
      Parameters:
      key - must not be null.
      Returns:
      See Also:
    • scan

      default Flux<V> scan(K key)
      Use a Flux to iterate over entries in the set at key. The resulting Flux acts as a cursor and issues SSCAN commands itself as long as the subscriber signals demand.
      Parameters:
      key - must not be null.
      Returns:
      the Flux emitting the values one by one or an empty Flux if none exist.
      Throws:
      IllegalArgumentException - when given key is null.
      Since:
      2.1
      See Also:
    • scan

      Flux<V> scan(K key, ScanOptions options)
      Use a Flux to iterate over entries in the set at key given ScanOptions. The resulting Flux acts as a cursor and issues SSCAN commands itself as long as the subscriber signals demand.
      Parameters:
      key - must not be null.
      options - must not be null. Use ScanOptions.NONE instead.
      Returns:
      the Flux emitting the values one by one or an empty Flux if the key does not exist.
      Throws:
      IllegalArgumentException - when one of the required arguments is null.
      Since:
      2.1
      See Also:
    • randomMember

      Mono<V> randomMember(K key)
      Get random element from set at key.
      Parameters:
      key - must not be null.
      Returns:
      See Also:
    • distinctRandomMembers

      Flux<V> distinctRandomMembers(K key, long count)
      Get count distinct random elements from set at key.
      Parameters:
      key - must not be null.
      count - number of members to return.
      Returns:
      See Also:
    • randomMembers

      Flux<V> randomMembers(K key, long count)
      Get count random elements from set at key.
      Parameters:
      key - must not be null.
      count - number of members to return.
      Returns:
      See Also:
    • delete

      Mono<Boolean> delete(K key)
      Removes the given key.
      Parameters:
      key - must not be null.