- Type Parameters:
K- Key type.V- Value type.
- All Known Subinterfaces:
RedisAdvancedClusterCommands<K,V>,RedisClusterCommands<K,V>,RedisClusterPubSubCommands<K,V>,RedisCommands<K,V>,RedisPubSubCommands<K,V>
public interface RedisSetCommands<K,V>
Synchronous executed commands for Sets.
- Since:
- 4.0
- Author:
- Mark Paluch
- Generated class:
- by io.lettuce.apigenerator.CreateSyncApi
-
Method Summary
Modifier and Type Method Description Longsadd(K key, V... members)Add one or more members to a set.Longscard(K key)Get the number of members in a set.Longsdiff(ValueStreamingChannel<V> channel, K... keys)Subtract multiple sets.Set<V>sdiff(K... keys)Subtract multiple sets.Longsdiffstore(K destination, K... keys)Subtract multiple sets and store the resulting set in a key.Longsinter(ValueStreamingChannel<V> channel, K... keys)Intersect multiple sets.Set<V>sinter(K... keys)Intersect multiple sets.Longsinterstore(K destination, K... keys)Intersect multiple sets and store the resulting set in a key.Booleansismember(K key, V member)Determine if a given value is a member of a set.Longsmembers(ValueStreamingChannel<V> channel, K key)Get all the members in a set.Set<V>smembers(K key)Get all the members in a set.List<Boolean>smismember(K key, V... members)Returns whether each member is a member of the set stored at key.Booleansmove(K source, K destination, V member)Move a member from one set to another.Vspop(K key)Remove and return a random member from a set.Set<V>spop(K key, long count)Remove and return one or multiple random members from a set.Longsrandmember(ValueStreamingChannel<V> channel, K key, long count)Get one or multiple random members from a set.Vsrandmember(K key)Get one random member from a set.List<V>srandmember(K key, long count)Get one or multiple random members from a set.Longsrem(K key, V... members)Remove one or more members from a set.StreamScanCursorsscan(ValueStreamingChannel<V> channel, K key)Incrementally iterate Set elements.StreamScanCursorsscan(ValueStreamingChannel<V> channel, K key, ScanArgs scanArgs)Incrementally iterate Set elements.StreamScanCursorsscan(ValueStreamingChannel<V> channel, K key, ScanCursor scanCursor)Incrementally iterate Set elements.StreamScanCursorsscan(ValueStreamingChannel<V> channel, K key, ScanCursor scanCursor, ScanArgs scanArgs)Incrementally iterate Set elements.ValueScanCursor<V>sscan(K key)Incrementally iterate Set elements.ValueScanCursor<V>sscan(K key, ScanArgs scanArgs)Incrementally iterate Set elements.ValueScanCursor<V>sscan(K key, ScanCursor scanCursor)Incrementally iterate Set elements.ValueScanCursor<V>sscan(K key, ScanCursor scanCursor, ScanArgs scanArgs)Incrementally iterate Set elements.Longsunion(ValueStreamingChannel<V> channel, K... keys)Add multiple sets.Set<V>sunion(K... keys)Add multiple sets.Longsunionstore(K destination, K... keys)Add multiple sets and store the resulting set in a key.
-
Method Details
-
sadd
Add one or more members to a set.- Parameters:
key- the key.members- the member type: value.- Returns:
- Long integer-reply the number of elements that were added to the set, not including all the elements already present into the set.
-
scard
Get the number of members in a set.- Parameters:
key- the key.- Returns:
- Long integer-reply the cardinality (number of elements) of the set, or
falseifkeydoes not exist.
-
sdiff
Subtract multiple sets.- Parameters:
keys- the key.- Returns:
- Set<V> array-reply list with members of the resulting set.
-
sdiff
Subtract multiple sets.- Parameters:
channel- the channel.keys- the keys.- Returns:
- Long count of members of the resulting set.
-
sdiffstore
Subtract multiple sets and store the resulting set in a key.- Parameters:
destination- the destination type: key.keys- the key.- Returns:
- Long integer-reply the number of elements in the resulting set.
-
sinter
Intersect multiple sets.- Parameters:
keys- the key.- Returns:
- Set<V> array-reply list with members of the resulting set.
-
sinter
Intersect multiple sets.- Parameters:
channel- the channel.keys- the keys.- Returns:
- Long count of members of the resulting set.
-
sinterstore
Intersect multiple sets and store the resulting set in a key.- Parameters:
destination- the destination type: key.keys- the key.- Returns:
- Long integer-reply the number of elements in the resulting set.
-
sismember
Determine if a given value is a member of a set.- Parameters:
key- the key.member- the member type: value.- Returns:
- Boolean integer-reply specifically:
trueif the element is a member of the set.falseif the element is not a member of the set, or ifkeydoes not exist.
-
smembers
Get all the members in a set.- Parameters:
key- the key.- Returns:
- Set<V> array-reply all elements of the set.
-
smembers
Get all the members in a set.- Parameters:
channel- the channel.key- the keys.- Returns:
- Long count of members of the resulting set.
-
smismember
Returns whether each member is a member of the set stored at key.- Parameters:
key- the key.members- the member type: value.- Returns:
- List<Boolean> array-reply list representing the membership of the given elements, in the same order as they are requested.
- Since:
- 6.1
-
smove
Move a member from one set to another.- Parameters:
source- the source key.destination- the destination type: key.member- the member type: value.- Returns:
- Boolean integer-reply specifically:
trueif the element is moved.falseif the element is not a member ofsourceand no operation was performed.
-
spop
Remove and return a random member from a set.- Parameters:
key- the key.- Returns:
- V bulk-string-reply the removed element, or
nullwhenkeydoes not exist.
-
spop
Remove and return one or multiple random members from a set.- Parameters:
key- the key.count- number of members to pop.- Returns:
- V bulk-string-reply the removed element, or
nullwhenkeydoes not exist.
-
srandmember
Get one random member from a set.- Parameters:
key- the key.- Returns:
- V bulk-string-reply without the additional
countargument the command returns a Bulk Reply with the randomly selected element, ornullwhenkeydoes not exist.
-
srandmember
Get one or multiple random members from a set.- Parameters:
key- the key.count- the count type: long.- Returns:
- Set<V> bulk-string-reply without the additional
countargument the command returns a Bulk Reply with the randomly selected element, ornullwhenkeydoes not exist.
-
srandmember
Get one or multiple random members from a set.- Parameters:
channel- streaming channel that receives a call for every value.key- the key.count- the count.- Returns:
- Long count of members of the resulting set.
-
srem
Remove one or more members from a set.- Parameters:
key- the key.members- the member type: value.- Returns:
- Long integer-reply the number of members that were removed from the set, not including non existing members.
-
sunion
Add multiple sets.- Parameters:
keys- the key.- Returns:
- Set<V> array-reply list with members of the resulting set.
-
sunion
Add multiple sets.- Parameters:
channel- streaming channel that receives a call for every value.keys- the keys.- Returns:
- Long count of members of the resulting set.
-
sunionstore
Add multiple sets and store the resulting set in a key.- Parameters:
destination- the destination type: key.keys- the key.- Returns:
- Long integer-reply the number of elements in the resulting set.
-
sscan
Incrementally iterate Set elements.- Parameters:
key- the key.- Returns:
- ValueScanCursor<V> scan cursor.
-
sscan
Incrementally iterate Set elements.- Parameters:
key- the key.scanArgs- scan arguments.- Returns:
- ValueScanCursor<V> scan cursor.
-
sscan
Incrementally iterate Set elements.- Parameters:
key- the key.scanCursor- cursor to resume from a previous scan, must not benull.scanArgs- scan arguments.- Returns:
- ValueScanCursor<V> scan cursor.
-
sscan
Incrementally iterate Set elements.- Parameters:
key- the key.scanCursor- cursor to resume from a previous scan, must not benull.- Returns:
- ValueScanCursor<V> scan cursor.
-
sscan
Incrementally iterate Set elements.- Parameters:
channel- streaming channel that receives a call for every value.key- the key.- Returns:
- StreamScanCursor scan cursor.
-
sscan
Incrementally iterate Set elements.- Parameters:
channel- streaming channel that receives a call for every value.key- the key.scanArgs- scan arguments.- Returns:
- StreamScanCursor scan cursor.
-
sscan
StreamScanCursor sscan(ValueStreamingChannel<V> channel, K key, ScanCursor scanCursor, ScanArgs scanArgs)Incrementally iterate Set elements.- Parameters:
channel- streaming channel that receives a call for every value.key- the key.scanCursor- cursor to resume from a previous scan, must not benull.scanArgs- scan arguments.- Returns:
- StreamScanCursor scan cursor.
-
sscan
Incrementally iterate Set elements.- Parameters:
channel- streaming channel that receives a call for every value.key- the key.scanCursor- cursor to resume from a previous scan, must not benull.- Returns:
- StreamScanCursor scan cursor.
-