Interface BoundSetOperations<K,V>

All Superinterfaces:
BoundKeyOperations<K>

@NullUnmarked public interface BoundSetOperations<K,V> extends BoundKeyOperations<K>
Set operations bound to a certain key.
Author:
Costin Leau, Mark Paluch, Mingi Lee
  • Method Summary

    Modifier and Type
    Method
    Description
    add(V @NonNull ... values)
    Add given values to set at the bound key.
    default void
    diffAndStore(@NonNull K keys, @NonNull K destKey)
    Deprecated.
    since 3.0, use differenceAndStore(Object, Object) instead to follow a consistent method naming scheme.
    default void
    diffAndStore(@NonNull Collection<@NonNull K> keys, @NonNull K destKey)
    Deprecated.
    since 3.0, use differenceAndStore(Collection, Object) instead to follow a consistent method naming scheme.
    Set<@NonNull V>
    difference(@NonNull K key)
    Diff all sets for given the bound key and key.
    Set<@NonNull V>
    difference(@NonNull Collection<@NonNull K> keys)
    Diff all sets for given the bound key and keys.
    void
    differenceAndStore(@NonNull K keys, @NonNull K destKey)
    Diff all sets for given the bound key and keys and store result in destKey.
    void
    differenceAndStore(@NonNull Collection<@NonNull K> keys, @NonNull K destKey)
    Diff all sets for given the bound key and keys and store result in destKey.
    Set<@NonNull V>
    Get count distinct random elements from set at the bound key.
    @NonNull RedisOperations<K,V>
     
    Set<@NonNull V>
    intersect(@NonNull K key)
    Returns the members intersecting all given sets at the bound key and key.
    Set<@NonNull V>
    intersect(@NonNull Collection<@NonNull K> keys)
    Returns the members intersecting all given sets at the bound key and keys.
    void
    intersectAndStore(@NonNull K key, @NonNull K destKey)
    Intersect all given sets at the bound key and key and store result in destKey.
    void
    intersectAndStore(@NonNull Collection<@NonNull K> keys, @NonNull K destKey)
    Intersect all given sets at the bound key and keys and store result in destKey.
    intersectSize(@NonNull K key)
    Returns the cardinality of the set which would result from the intersection of the bound key and key.
    intersectSize(@NonNull Collection<@NonNull K> keys)
    Returns the cardinality of the set which would result from the intersection of the bound key and keys.
    isMember(@NonNull Object o)
    Check if set at the bound key contains value.
    isMember(Object @NonNull ... objects)
    Check if set at at the bound key contains one or more values.
    Set<@NonNull V>
    Get all elements of set at the bound key.
    move(@NonNull K destKey, @NonNull V value)
    Move value from the bound key to destKey
    pop()
    Remove and return a random member from set at the bound key.
    Get random element from set at the bound key.
    List<@NonNull V>
    randomMembers(long count)
    Get count random elements from set at the bound key.
    remove(Object @NonNull ... values)
    Remove given values from set at the bound key and return the number of removed elements.
    Cursor<@NonNull V>
    scan(@NonNull ScanOptions options)
    Use a Cursor to iterate over entries in set at key.
    Get size of set at the bound key.
    Set<@NonNull V>
    union(@NonNull K key)
    Union all sets at given key and key.
    Set<@NonNull V>
    union(@NonNull Collection<@NonNull K> keys)
    Union all sets at given keys and keys.
    void
    unionAndStore(@NonNull K key, @NonNull K destKey)
    Union all sets at given the bound key and key and store result in destKey.
    void
    unionAndStore(@NonNull Collection<@NonNull K> keys, @NonNull K destKey)
    Union all sets at given the bound key and keys and store result in destKey.
  • Method Details

    • add

      Long add(V @NonNull ... values)
      Add given values to set at the bound key.
      Parameters:
      values -
      Returns:
      null when used in pipeline / transaction.
      See Also:
    • remove

      Long remove(Object @NonNull ... values)
      Remove given values from set at the bound key and return the number of removed elements.
      Parameters:
      values -
      Returns:
      null when used in pipeline / transaction.
      See Also:
    • pop

      V pop()
      Remove and return a random member from set at the bound key.
      Returns:
      null when used in pipeline / transaction.
      See Also:
    • move

      Boolean move(@NonNull K destKey, @NonNull V value)
      Move value from the bound key to destKey
      Parameters:
      destKey - must not be null.
      value -
      Returns:
      null when used in pipeline / transaction.
      See Also:
    • size

      Long size()
      Get size of set at the bound key.
      Returns:
      null when used in pipeline / transaction.
      See Also:
    • isMember

      Boolean isMember(@NonNull Object o)
      Check if set at the bound key contains value.
      Parameters:
      o -
      Returns:
      null when used in pipeline / transaction.
      See Also:
    • isMember

      Map<Object,Boolean> isMember(Object @NonNull ... objects)
      Check if set at at the bound key contains one or more values.
      Parameters:
      objects -
      Returns:
      null when used in pipeline / transaction.
      Since:
      2.6
      See Also:
    • intersect

      Set<@NonNull V> intersect(@NonNull K key)
      Returns the members intersecting all given sets at the bound key and key.
      Parameters:
      key - must not be null.
      Returns:
      null when used in pipeline / transaction.
      See Also:
    • intersect

      Set<@NonNull V> intersect(@NonNull Collection<@NonNull K> keys)
      Returns the members intersecting all given sets at the bound key and keys.
      Parameters:
      keys - must not be null.
      Returns:
      null when used in pipeline / transaction.
      See Also:
    • intersectAndStore

      void intersectAndStore(@NonNull K key, @NonNull K destKey)
      Intersect all given sets at the bound key and key and store result in destKey.
      Parameters:
      key - must not be null.
      destKey - must not be null.
      See Also:
    • intersectAndStore

      void intersectAndStore(@NonNull Collection<@NonNull K> keys, @NonNull K destKey)
      Intersect all given sets at the bound key and keys and store result in destKey.
      Parameters:
      keys - must not be null.
      destKey - must not be null.
      See Also:
    • intersectSize

      Long intersectSize(@NonNull K key)
      Returns the cardinality of the set which would result from the intersection of the bound key and key.
      Parameters:
      key - must not be null.
      Returns:
      null when used in pipeline / transaction.
      Since:
      4.0
      See Also:
    • intersectSize

      Long intersectSize(@NonNull Collection<@NonNull K> keys)
      Returns the cardinality of the set which would result from the intersection of the bound key and keys.
      Parameters:
      keys - must not be null.
      Returns:
      null when used in pipeline / transaction.
      Since:
      4.0
      See Also:
    • union

      Set<@NonNull V> union(@NonNull K key)
      Union all sets at given key and key.
      Parameters:
      key - must not be null.
      Returns:
      null when used in pipeline / transaction.
      See Also:
    • union

      Set<@NonNull V> union(@NonNull Collection<@NonNull K> keys)
      Union all sets at given keys and keys.
      Parameters:
      keys - must not be null.
      Returns:
      null when used in pipeline / transaction.
      See Also:
    • unionAndStore

      void unionAndStore(@NonNull K key, @NonNull K destKey)
      Union all sets at given the bound key and key and store result in destKey.
      Parameters:
      key - must not be null.
      destKey - must not be null.
      See Also:
    • unionAndStore

      void unionAndStore(@NonNull Collection<@NonNull K> keys, @NonNull K destKey)
      Union all sets at given the bound key and keys and store result in destKey.
      Parameters:
      keys - must not be null.
      destKey - must not be null.
      See Also:
    • difference

      Set<@NonNull V> difference(@NonNull K key)
      Diff all sets for given the bound key and key.
      Parameters:
      key - must not be null.
      Returns:
      null when used in pipeline / transaction.
      Since:
      3.0
      See Also:
    • difference

      Set<@NonNull V> difference(@NonNull Collection<@NonNull K> keys)
      Diff all sets for given the bound key and keys.
      Parameters:
      keys - must not be null.
      Returns:
      null when used in pipeline / transaction.
      Since:
      3.0
      See Also:
    • diffAndStore

      @Deprecated default void diffAndStore(@NonNull K keys, @NonNull K destKey)
      Deprecated.
      since 3.0, use differenceAndStore(Object, Object) instead to follow a consistent method naming scheme.
      Diff all sets for given the bound key and keys and store result in destKey.
      Parameters:
      keys - must not be null.
      destKey - must not be null.
      See Also:
    • differenceAndStore

      void differenceAndStore(@NonNull K keys, @NonNull K destKey)
      Diff all sets for given the bound key and keys and store result in destKey.
      Parameters:
      keys - must not be null.
      destKey - must not be null.
      Since:
      3.0
      See Also:
    • diffAndStore

      @Deprecated default void diffAndStore(@NonNull Collection<@NonNull K> keys, @NonNull K destKey)
      Deprecated.
      since 3.0, use differenceAndStore(Collection, Object) instead to follow a consistent method naming scheme.
      Diff all sets for given the bound key and keys and store result in destKey.
      Parameters:
      keys - must not be null.
      destKey - must not be null.
      See Also:
    • differenceAndStore

      void differenceAndStore(@NonNull Collection<@NonNull K> keys, @NonNull K destKey)
      Diff all sets for given the bound key and keys and store result in destKey.
      Parameters:
      keys - must not be null.
      destKey - must not be null.
      Since:
      3.0
      See Also:
    • members

      Set<@NonNull V> members()
      Get all elements of set at the bound key.
      Returns:
      null when used in pipeline / transaction.
      See Also:
    • randomMember

      V randomMember()
      Get random element from set at the bound key.
      Returns:
      null when used in pipeline / transaction.
      See Also:
    • distinctRandomMembers

      Set<@NonNull V> distinctRandomMembers(long count)
      Get count distinct random elements from set at the bound key.
      Parameters:
      count -
      Returns:
      null when used in pipeline / transaction.
      See Also:
    • randomMembers

      List<@NonNull V> randomMembers(long count)
      Get count random elements from set at the bound key.
      Parameters:
      count -
      Returns:
      null when used in pipeline / transaction.
      See Also:
    • scan

      Cursor<@NonNull V> scan(@NonNull ScanOptions options)
      Use a Cursor to iterate over entries in set at key.
      Important: Call CloseableIterator.close() when done to avoid resource leaks.
      Parameters:
      options - must not be null.
      Returns:
      the result cursor providing access to the scan result. Must be closed once fully processed (e.g. through a try-with-resources clause).
      Since:
      1.4
    • getOperations

      @NonNull RedisOperations<K,V> getOperations()
      Specified by:
      getOperations in interface BoundKeyOperations<K>
      Returns:
      the underlying RedisOperations used to execute commands.