Type Parameters:
E - the type of elements in this collection.
All Superinterfaces:
BoundKeyOperations<String>, Collection<E>, Iterable<E>, RedisCollection<E>, RedisStore, Set<E>
All Known Implementing Classes:
DefaultRedisSet

public interface RedisSet<E> extends RedisCollection<E>, Set<E>
Redis extension for the Set contract. Supports Set specific operations backed by Redis operations.
Author:
Costin Leau, Christoph Strobl, Mark Paluch
  • Method Details

    • create

      static <E> RedisSet<E> create(String key, RedisOperations<String,E> operations)
      Constructs a new RedisSet instance.
      Parameters:
      key - Redis key of this set.
      operations - RedisOperations for the value type of this set.
      Since:
      2.6
    • diff

      Set<E> diff(RedisSet<?> set)
      Diff this set and another RedisSet.
      Parameters:
      set - must not be null.
      Returns:
      a Set containing the values that differ.
      Since:
      1.0
    • diff

      Set<E> diff(Collection<? extends RedisSet<?>> sets)
      Diff this set and other RedisSets.
      Parameters:
      sets - must not be null.
      Returns:
      a Set containing the values that differ.
      Since:
      1.0
    • diffAndStore

      RedisSet<E> diffAndStore(RedisSet<?> set, String destKey)
      Create a new RedisSet by diffing this sorted set and RedisSet and store result in destination destKey.
      Parameters:
      set - must not be null.
      destKey - must not be null.
      Returns:
      a new RedisSet pointing at destKey.
      Since:
      1.0
    • diffAndStore

      RedisSet<E> diffAndStore(Collection<? extends RedisSet<?>> sets, String destKey)
      Create a new RedisSet by diffing this sorted set and the collection RedisSet and store result in destination destKey.
      Parameters:
      sets - must not be null.
      destKey - must not be null.
      Returns:
      a new RedisSet pointing at destKey.
      Since:
      1.0
    • intersect

      Set<E> intersect(RedisSet<?> set)
      Intersect this set and another RedisSet.
      Parameters:
      set - must not be null.
      Returns:
      a Set containing the intersecting values.
      Since:
      1.0
    • intersect

      Set<E> intersect(Collection<? extends RedisSet<?>> sets)
      Intersect this set and other RedisSets.
      Parameters:
      sets - must not be null.
      Returns:
      a Set containing the intersecting values.
      Since:
      1.0
    • intersectAndStore

      RedisSet<E> intersectAndStore(RedisSet<?> set, String destKey)
      Create a new RedisSet by intersecting this sorted set and RedisSet and store result in destination destKey.
      Parameters:
      set - must not be null.
      destKey - must not be null.
      Returns:
      a new RedisSet pointing at destKey
      Since:
      1.0
    • intersectAndStore

      RedisSet<E> intersectAndStore(Collection<? extends RedisSet<?>> sets, String destKey)
      Create a new RedisSet by intersecting this sorted set and the collection RedisSet and store result in destination destKey.
      Parameters:
      sets - must not be null.
      destKey - must not be null.
      Returns:
      a new RedisSet pointing at destKey.
      Since:
      1.0
    • randomValue

      E randomValue()
      Get random element from the set.
      Returns:
      Since:
      2.6
    • scan

      Iterator<E> scan()
      Returns:
      Since:
      1.4
    • union

      Set<E> union(RedisSet<?> set)
      Union this set and another RedisSet.
      Parameters:
      set - must not be null.
      Returns:
      a Set containing the combined values.
      Since:
      2.6
    • union

      Set<E> union(Collection<? extends RedisSet<?>> sets)
      Union this set and other RedisSets.
      Parameters:
      sets - must not be null.
      Returns:
      a Set containing the combined values.
      Since:
      1.0
    • unionAndStore

      RedisSet<E> unionAndStore(RedisSet<?> set, String destKey)
      Create a new RedisSet by union this sorted set and RedisSet and store result in destination destKey.
      Parameters:
      set - must not be null.
      destKey - must not be null.
      Returns:
      a new RedisSet pointing at destKey.
      Since:
      1.0
    • unionAndStore

      RedisSet<E> unionAndStore(Collection<? extends RedisSet<?>> sets, String destKey)
      Create a new RedisSet by union this sorted set and the collection RedisSet and store result in destination destKey.
      Parameters:
      sets - must not be null.
      destKey - must not be null.
      Returns:
      a new RedisSet pointing at destKey.
      Since:
      1.0