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
-
sRem
-
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
-
sCard
-
sIsMember
-
sMIsMember
-
sDiff
-
sDiffStore
-
sInter
-
sInterStore
-
sUnion
-
sUnionStore
-
sMembers
-
sRandMember
Get random element from set atkey.- Parameters:
key- must not be null.- Returns:
- can be null.
- See Also:
-
sRandMember
-
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:
-