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 Summary

    Modifier and Type
    Method
    Description
    reactor.core.publisher.Mono<Long>
    add(K key, V... values)
    Add given values to set at key.
    reactor.core.publisher.Mono<Boolean>
    delete(K key)
    Removes the given key.
    reactor.core.publisher.Flux<V>
    Diff all sets for given keys.
    reactor.core.publisher.Flux<V>
    difference(K key, Collection<K> otherKeys)
    Diff all sets for given key and otherKeys.
    reactor.core.publisher.Flux<V>
    difference(K key, K otherKey)
    Diff all sets for given key and otherKey.
    reactor.core.publisher.Mono<Long>
    differenceAndStore(Collection<K> keys, K destKey)
    Diff all sets for given keys and store result in destKey.
    reactor.core.publisher.Mono<Long>
    differenceAndStore(K key, Collection<K> otherKeys, K destKey)
    Diff all sets for given key and otherKeys and store result in destKey.
    reactor.core.publisher.Mono<Long>
    differenceAndStore(K key, K otherKey, K destKey)
    Diff all sets for given key and otherKey and store result in destKey.
    reactor.core.publisher.Flux<V>
    distinctRandomMembers(K key, long count)
    Get count distinct random elements from set at key.
    reactor.core.publisher.Flux<V>
    Returns the members intersecting all given sets at keys.
    reactor.core.publisher.Flux<V>
    intersect(K key, Collection<K> otherKeys)
    Returns the members intersecting all given sets at key and otherKeys.
    reactor.core.publisher.Flux<V>
    intersect(K key, K otherKey)
    Returns the members intersecting all given sets at key and otherKey.
    reactor.core.publisher.Mono<Long>
    intersectAndStore(Collection<K> keys, K destKey)
    Intersect all given sets at keys and store result in destKey.
    reactor.core.publisher.Mono<Long>
    intersectAndStore(K key, Collection<K> otherKeys, K destKey)
    Intersect all given sets at key and otherKeys and store result in destKey.
    reactor.core.publisher.Mono<Long>
    intersectAndStore(K key, K otherKey, K destKey)
    Intersect all given sets at key and otherKey and store result in destKey.
    reactor.core.publisher.Mono<Boolean>
    isMember(K key, Object o)
    Check if set at key contains value.
    reactor.core.publisher.Mono<Map<Object,Boolean>>
    isMember(K key, Object... objects)
    Check if set at key contains one or more values.
    reactor.core.publisher.Flux<V>
    members(K key)
    Get all elements of set at key.
    reactor.core.publisher.Mono<Boolean>
    move(K sourceKey, V value, K destKey)
    Move value from key to destKey
    reactor.core.publisher.Mono<V>
    pop(K key)
    Remove and return a random member from set at key.
    reactor.core.publisher.Flux<V>
    pop(K key, long count)
    Remove and return count random members from set at key.
    reactor.core.publisher.Mono<V>
    Get random element from set at key.
    reactor.core.publisher.Flux<V>
    randomMembers(K key, long count)
    Get count random elements from set at key.
    reactor.core.publisher.Mono<Long>
    remove(K key, Object... values)
    Remove given values from set at key and return the number of removed elements.
    default reactor.core.publisher.Flux<V>
    scan(K key)
    Use a Flux to iterate over entries in the set at key.
    reactor.core.publisher.Flux<V>
    scan(K key, ScanOptions options)
    Use a Flux to iterate over entries in the set at key given ScanOptions.
    reactor.core.publisher.Mono<Long>
    size(K key)
    Get size of set at key.
    reactor.core.publisher.Flux<V>
    Union all sets at given keys.
    reactor.core.publisher.Flux<V>
    union(K key, Collection<K> otherKeys)
    Union all sets at given keys and otherKeys.
    reactor.core.publisher.Flux<V>
    union(K key, K otherKey)
    Union all sets at given keys and otherKey.
    reactor.core.publisher.Mono<Long>
    unionAndStore(Collection<K> keys, K destKey)
    Union all sets at given keys and store result in destKey.
    reactor.core.publisher.Mono<Long>
    unionAndStore(K key, Collection<K> otherKeys, K destKey)
    Union all sets at given key and otherKeys and store result in destKey.
    reactor.core.publisher.Mono<Long>
    unionAndStore(K key, K otherKey, K destKey)
    Union all sets at given key and otherKey and store result in destKey.
  • Method Details

    • add

      reactor.core.publisher.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

      reactor.core.publisher.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

      reactor.core.publisher.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

      reactor.core.publisher.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

      reactor.core.publisher.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

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

      reactor.core.publisher.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

      reactor.core.publisher.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

      reactor.core.publisher.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

      reactor.core.publisher.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

      reactor.core.publisher.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

      reactor.core.publisher.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

      reactor.core.publisher.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

      reactor.core.publisher.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

      reactor.core.publisher.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

      reactor.core.publisher.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

      reactor.core.publisher.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

      reactor.core.publisher.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

      reactor.core.publisher.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

      reactor.core.publisher.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

      reactor.core.publisher.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

      reactor.core.publisher.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

      reactor.core.publisher.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

      reactor.core.publisher.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

      reactor.core.publisher.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

      reactor.core.publisher.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

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

      default reactor.core.publisher.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

      reactor.core.publisher.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

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

      reactor.core.publisher.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

      reactor.core.publisher.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

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