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