Interface RedisSetCommands
- All Known Subinterfaces:
DefaultedRedisClusterConnection,DefaultedRedisConnection,RedisClusterConnection,RedisCommands,RedisConnection,RedisConnectionUtils.RedisConnectionProxy,StringRedisConnection
- All Known Implementing Classes:
AbstractRedisConnection,DefaultStringRedisConnection,JedisClusterConnection,JedisConnection,LettuceClusterConnection,LettuceConnection
@NullUnmarked
public interface RedisSetCommands
Set-specific commands supported by Redis.
- Author:
- Costin Leau, Christoph Strobl, Mark Paluch
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionsAdd(byte @NonNull [] key, byte @NonNull [] @NonNull ... values) Add givenvaluesto set atkey.sCard(byte @NonNull [] key) Get size of set atkey.Set<byte @NonNull []> sDiff(byte @NonNull [] @NonNull ... keys) Diff all sets for givenkeys.sDiffStore(byte @NonNull [] destKey, byte @NonNull [] @NonNull ... keys) Diff all sets for givenkeysand store result indestKey.Set<byte @NonNull []> sInter(byte @NonNull [] @NonNull ... keys) Returns the members intersecting all given sets atkeys.sInterStore(byte @NonNull [] destKey, byte @NonNull [] @NonNull ... keys) Intersect all given sets atkeysand store result indestKey.sIsMember(byte @NonNull [] key, byte @NonNull [] value) Check if set atkeycontainsvalue.Set<byte @NonNull []> sMembers(byte @NonNull [] key) Get all elements of set atkey.sMIsMember(byte @NonNull [] key, byte @NonNull [] @NonNull ... values) Check if set atkeycontains one or morevalues.sMove(byte @NonNull [] srcKey, byte @NonNull [] destKey, byte @NonNull [] value) MovevaluefromsrcKeytodestKeybyte[]sPop(byte @NonNull [] key) Remove and return a random member from set atkey.List<byte @NonNull []> sPop(byte @NonNull [] key, long count) Remove and returncountrandom members from set atkey.byte[]sRandMember(byte @NonNull [] key) Get random element from set atkey.List<byte @NonNull []> sRandMember(byte @NonNull [] key, long count) Getcountrandom elements from set atkey.sRem(byte @NonNull [] key, byte @NonNull []... values) Remove givenvaluesfrom set atkeyand return the number of removed elements.Cursor<byte @NonNull []> sScan(byte @NonNull [] key, ScanOptions options) Use aCursorto iterate over elements in set atkey.Set<byte @NonNull []> sUnion(byte @NonNull [] @NonNull ... keys) Union all sets at givenkeys.sUnionStore(byte @NonNull [] destKey, byte @NonNull [] @NonNull ... 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
byte[] sPop(byte @NonNull [] key) 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
-
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
-
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
-
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
-
sRandMember
byte[] sRandMember(byte @NonNull [] key) 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:
-