K
- Key type.V
- Value type.public interface RedisSetCommands<K,V>
Modifier and Type | Method and Description |
---|---|
Long |
sadd(K key,
V... members)
Add one or more members to a set.
|
Long |
scard(K key)
Get the number of members in a set.
|
Set<V> |
sdiff(K... keys)
Subtract multiple sets.
|
Long |
sdiff(ValueStreamingChannel<V> channel,
K... keys)
Subtract multiple sets.
|
Long |
sdiffstore(K destination,
K... keys)
Subtract multiple sets and store the resulting set in a key.
|
Set<V> |
sinter(K... keys)
Intersect multiple sets.
|
Long |
sinter(ValueStreamingChannel<V> channel,
K... keys)
Intersect multiple sets.
|
Long |
sintercard(K... keys)
This command works exactly like
sinter(java.lang.Object[]) but instead of returning the result set, it returns
just the cardinality of the result. |
Long |
sintercard(long limit,
K... keys)
This command works exactly like
sinter(java.lang.Object[]) but instead of returning the result set, it returns
just the cardinality of the result. |
Long |
sinterstore(K destination,
K... keys)
Intersect multiple sets and store the resulting set in a key.
|
Boolean |
sismember(K key,
V member)
Determine if a given value is a member of a set.
|
Set<V> |
smembers(K key)
Get all the members in a set.
|
Long |
smembers(ValueStreamingChannel<V> channel,
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.
|
Boolean |
smove(K source,
K destination,
V member)
Move a member from one set to another.
|
V |
spop(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.
|
V |
srandmember(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.
|
Long |
srandmember(ValueStreamingChannel<V> channel,
K key,
long count)
Get one or multiple random members from a set.
|
Long |
srem(K key,
V... members)
Remove one or more members from a set.
|
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.
|
StreamScanCursor |
sscan(ValueStreamingChannel<V> channel,
K key)
Incrementally iterate Set elements.
|
StreamScanCursor |
sscan(ValueStreamingChannel<V> channel,
K key,
ScanArgs scanArgs)
Incrementally iterate Set elements.
|
StreamScanCursor |
sscan(ValueStreamingChannel<V> channel,
K key,
ScanCursor scanCursor)
Incrementally iterate Set elements.
|
StreamScanCursor |
sscan(ValueStreamingChannel<V> channel,
K key,
ScanCursor scanCursor,
ScanArgs scanArgs)
Incrementally iterate Set elements.
|
Set<V> |
sunion(K... keys)
Add multiple sets.
|
Long |
sunion(ValueStreamingChannel<V> channel,
K... keys)
Add multiple sets.
|
Long |
sunionstore(K destination,
K... keys)
Add multiple sets and store the resulting set in a key.
|
Long sadd(K key, V... members)
key
- the key.members
- the member type: value.Long scard(K key)
key
- the key.false
if key
does not
exist.Set<V> sdiff(K... keys)
keys
- the key.Long sdiff(ValueStreamingChannel<V> channel, K... keys)
channel
- the channel.keys
- the keys.Long sdiffstore(K destination, K... keys)
destination
- the destination type: key.keys
- the key.Set<V> sinter(K... keys)
keys
- the key.Long sinter(ValueStreamingChannel<V> channel, K... keys)
channel
- the channel.keys
- the keys.Long sintercard(K... keys)
sinter(java.lang.Object[])
but instead of returning the result set, it returns
just the cardinality of the result.keys
- the keys.Long sintercard(long limit, K... keys)
sinter(java.lang.Object[])
but instead of returning the result set, it returns
just the cardinality of the result.limit
- If the intersection cardinality reaches limit partway through the computation, the algorithm will exit and
yield limit as the cardinality.keys
- the keys.Long sinterstore(K destination, K... keys)
destination
- the destination type: key.keys
- the key.Boolean sismember(K key, V member)
key
- the key.member
- the member type: value.true
if the element is a member of the set. false
if the element is not a member of the set, or
if key
does not exist.Set<V> smembers(K key)
key
- the key.Long smembers(ValueStreamingChannel<V> channel, K key)
channel
- the channel.key
- the keys.List<Boolean> smismember(K key, V... members)
key
- the key.members
- the member type: value.Boolean smove(K source, K destination, V member)
source
- the source key.destination
- the destination type: key.member
- the member type: value.true
if the element is moved. false
if the element is not a member of source
and no
operation was performed.V spop(K key)
key
- the key.null
when key
does not exist.Set<V> spop(K key, long count)
key
- the key.count
- number of members to pop.null
when key
does not exist.V srandmember(K key)
key
- the key.count
argument the command returns a Bulk Reply with the
randomly selected element, or null
when key
does not exist.List<V> srandmember(K key, long count)
key
- the key.count
- the count type: long.count
argument the command returns a Bulk Reply
with the randomly selected element, or null
when key
does not exist.Long srandmember(ValueStreamingChannel<V> channel, K key, long count)
channel
- streaming channel that receives a call for every value.key
- the key.count
- the count.Long srem(K key, V... members)
key
- the key.members
- the member type: value.Set<V> sunion(K... keys)
keys
- the key.Long sunion(ValueStreamingChannel<V> channel, K... keys)
channel
- streaming channel that receives a call for every value.keys
- the keys.Long sunionstore(K destination, K... keys)
destination
- the destination type: key.keys
- the key.ValueScanCursor<V> sscan(K key)
key
- the key.ValueScanCursor<V> sscan(K key, ScanArgs scanArgs)
key
- the key.scanArgs
- scan arguments.ValueScanCursor<V> sscan(K key, ScanCursor scanCursor, ScanArgs scanArgs)
key
- the key.scanCursor
- cursor to resume from a previous scan, must not be null
.scanArgs
- scan arguments.ValueScanCursor<V> sscan(K key, ScanCursor scanCursor)
key
- the key.scanCursor
- cursor to resume from a previous scan, must not be null
.StreamScanCursor sscan(ValueStreamingChannel<V> channel, K key)
channel
- streaming channel that receives a call for every value.key
- the key.StreamScanCursor sscan(ValueStreamingChannel<V> channel, K key, ScanArgs scanArgs)
channel
- streaming channel that receives a call for every value.key
- the key.scanArgs
- scan arguments.StreamScanCursor sscan(ValueStreamingChannel<V> channel, K key, ScanCursor scanCursor, ScanArgs scanArgs)
channel
- streaming channel that receives a call for every value.key
- the key.scanCursor
- cursor to resume from a previous scan, must not be null
.scanArgs
- scan arguments.StreamScanCursor sscan(ValueStreamingChannel<V> channel, K key, ScanCursor scanCursor)
channel
- streaming channel that receives a call for every value.key
- the key.scanCursor
- cursor to resume from a previous scan, must not be null
.Copyright © 2025 lettuce.io. All rights reserved.