Interface RedisSetCommands
- All Known Subinterfaces:
 DefaultedRedisClusterConnection,DefaultedRedisConnection,RedisClusterConnection,RedisCommands,RedisConnection,RedisConnectionUtils.RedisConnectionProxy,StringRedisConnection
- All Known Implementing Classes:
 AbstractRedisConnection,DefaultStringRedisConnection,JedisClusterConnection,JedisConnection,LettuceClusterConnection,LettuceConnection
public interface RedisSetCommands
Set-specific commands supported by Redis.
- Author:
 - Costin Leau, Christoph Strobl, Mark Paluch
 
- 
Method Summary
Modifier and TypeMethodDescriptionsAdd(byte[] key, byte[]... values) Add givenvaluesto set atkey.sCard(byte[] key) Get size of set atkey.Set<byte[]>sDiff(byte[]... keys) Diff all sets for givenkeys.sDiffStore(byte[] destKey, byte[]... keys) Diff all sets for givenkeysand store result indestKey.Set<byte[]>sInter(byte[]... keys) Returns the members intersecting all given sets atkeys.sInterStore(byte[] destKey, byte[]... keys) Intersect all given sets atkeysand store result indestKey.sIsMember(byte[] key, byte[] value) Check if set atkeycontainsvalue.Set<byte[]>sMembers(byte[] key) Get all elements of set atkey.sMIsMember(byte[] key, byte[]... values) Check if set atkeycontains one or morevalues.sMove(byte[] srcKey, byte[] destKey, byte[] value) MovevaluefromsrcKeytodestKeybyte[]sPop(byte[] key) Remove and return a random member from set atkey.List<byte[]>sPop(byte[] key, long count) Remove and returncountrandom members from set atkey.byte[]sRandMember(byte[] key) Get random element from set atkey.List<byte[]>sRandMember(byte[] key, long count) Getcountrandom elements from set atkey.sRem(byte[] key, byte[]... values) Remove givenvaluesfrom set atkeyand return the number of removed elements.Cursor<byte[]>sScan(byte[] key, ScanOptions options) Use aCursorto iterate over elements in set atkey.Set<byte[]>sUnion(byte[]... keys) Union all sets at givenkeys.sUnionStore(byte[] destKey, byte[]... keys) Union all sets at givenkeysand store result indestKey. 
- 
Method Details
- 
sAdd
Add givenvaluesto set atkey.- Parameters:
 key- must not be null.values- must not be empty.- Returns:
 - null when used in pipeline / transaction.
 - See Also:
 
 - 
sRem
Remove givenvaluesfrom set atkeyand return the number of removed elements.- Parameters:
 key- must not be null.values- must not be empty.- Returns:
 - null when used in pipeline / transaction.
 - See Also:
 
 - 
sPop
Remove and return a random member from set atkey.- Parameters:
 key- must not be null.- Returns:
 - null when key does not exist or used in pipeline / transaction.
 - See Also:
 
 - 
sPop
Remove and returncountrandom members from set atkey.- Parameters:
 key- must not be null.count- number of random members to pop from the set.- Returns:
 - empty 
Listif set does not exist. null when used in pipeline / transaction. - Since:
 - 2.0
 - See Also:
 
 - 
sMove
MovevaluefromsrcKeytodestKey- Parameters:
 srcKey- must not be null.destKey- must not be null.value- must not be null.- Returns:
 - null when used in pipeline / transaction.
 - See Also:
 
 - 
sCard
Get size of set atkey.- Parameters:
 key- must not be null.- Returns:
 - null when used in pipeline / transaction.
 - See Also:
 
 - 
sIsMember
Check if set atkeycontainsvalue.- Parameters:
 key- must not be null.value- must not be null.- Returns:
 - null when used in pipeline / transaction.
 - See Also:
 
 - 
sMIsMember
Check if set atkeycontains one or morevalues.- Parameters:
 key- must not be null.values- must not be null.- Returns:
 - null when used in pipeline / transaction.
 - Since:
 - 2.6
 - See Also:
 
 - 
sDiff
Diff all sets for givenkeys.- Parameters:
 keys- must not be null.- Returns:
 - null when used in pipeline / transaction.
 - See Also:
 
 - 
sDiffStore
Diff all sets for givenkeysand store result indestKey.- Parameters:
 destKey- must not be null.keys- must not be null.- Returns:
 - null when used in pipeline / transaction.
 - See Also:
 
 - 
sInter
Returns the members intersecting all given sets atkeys.- Parameters:
 keys- must not be null.- Returns:
 - empty 
Setif no intersection found. null when used in pipeline / transaction. - See Also:
 
 - 
sInterStore
Intersect all given sets atkeysand store result indestKey.- Parameters:
 destKey- must not be null.keys- must not be null.- Returns:
 - null when used in pipeline / transaction.
 - See Also:
 
 - 
sUnion
Union all sets at givenkeys.- Parameters:
 keys- must not be null.- Returns:
 - empty 
Setif keys do not exist. null when used in pipeline / transaction. - See Also:
 
 - 
sUnionStore
Union all sets at givenkeysand store result indestKey.- Parameters:
 destKey- must not be null.keys- must not be null.- Returns:
 - null when used in pipeline / transaction.
 - See Also:
 
 - 
sMembers
Get all elements of set atkey.- Parameters:
 key- must not be null.- Returns:
 - empty 
Setwhen key does not exist. null when used in pipeline / transaction. - See Also:
 
 - 
sRandMember
Get random element from set atkey.- Parameters:
 key- must not be null.- Returns:
 - can be null.
 - See Also:
 
 - 
sRandMember
Getcountrandom elements from set atkey.- Parameters:
 key- must not be null.count-- Returns:
 - null when used in pipeline / transaction.
 - See Also:
 
 - 
sScan
Use aCursorto iterate over elements in set atkey.- Parameters:
 key- must not be null.options- must not be null.- Returns:
 - never null.
 - Since:
 - 1.4
 - See Also:
 
 
 -