EsRedisSetCommands
Description
Provides an API for the Redis Set commands. Redis Sets are an unordered collection of unique strings.
This command group is accessed via EsRedisClient>>sets.
Class Methods
None
Instance Methods
sadd:members:
Add one or more members to a set.
Arguments:
aKey - <String> The key of the set.
aMemberOrCollection - <Object | SequenceableCollection> The member or members to add.
Answers:
<Integer> The number of elements that were added to the set.
<EsFuture> In async mode, a future that completes with the result.
scard:
Get the number of members in a set.
Arguments:
aKey - <String> The key of the set.
Answers:
<Integer> The cardinality (number of elements) of the set.
<EsFuture> In async mode, a future that completes with the result.
sdiff:
Subtract multiple sets.
Arguments:
aCollectionOfKeys - <SequenceableCollection> The keys of the sets to subtract.
Answers:
<Set> A set of members of the resulting set. The reply is
normalized to a Set for protocol consistency.
<EsFuture> In async mode, a future that completes with the result.
sdiffstore:keys:
Subtract multiple sets and store the resulting set in a key.
Arguments:
aDestKey - <String> The destination key.
aCollectionOfKeys - <Collection> The keys of the sets to subtract.
Answers:
<Integer> The number of elements in the resulting set.
<EsFuture> In async mode, a future that completes with the result.
sinter:
Intersect multiple sets.
Arguments:
aCollectionOfKeys - <SequenceableCollection> The keys of the sets to intersect.
Answers:
<Set> A set of members of the resulting set. The reply is
normalized to a Set for protocol consistency.
<EsFuture> In async mode, a future that completes with the result.
sintercard:
Intersect multiple sets and return the cardinality of the intersection.
Arguments:
aCollectionOfKeys - <Collection> The keys of the sets to intersect.
Answers:
<Integer> The number of elements in the resulting intersection.
<EsFuture> In async mode, a future that completes with the result.
sinterstore:keys:
Intersect multiple sets and store the resulting set in a new key.
Arguments:
aDestKey - <String> The destination key.
aCollectionOfKeys - <Collection> The keys of the sets to intersect.
Answers:
<Integer> The number of elements in the resulting set.
<EsFuture> In async mode, a future that completes with the result.
sismember:member:
Determine if a given value is a member of a set.
Arguments:
aKey - <String> The key of the set.
aMember - <Object> The member to check for.
Answers:
<Boolean> true if the member is an element of the set, false otherwise.
<EsFuture> In async mode, a future that completes with the result.
smembers:
Get all the members in a set.
Arguments:
aKey - <String> The key of the set.
Answers:
<Set> A set of all the members in the set. The reply is
normalized to a Set for protocol consistency.
<EsFuture> In async mode, a future that completes with the result.
smove:to:member:
Move a member from one set to another.
Arguments:
aSourceKey - <String> The source key.
aDestKey - <String> The destination key.
aMember - <Object> The member to move.
Answers:
<Boolean> true if the member was moved, false otherwise.
<EsFuture> In async mode, a future that completes with the result.
spop:
Remove and return one random member from a set.
Arguments:
aKey - <String> The key of the set.
Answers:
<String | ByteArray> The removed member, or nil if the set is empty.
<EsFuture> In async mode, a future that completes with the result.
spop:count:
Remove and return one or more random members from a set.
Arguments:
aKey - <String> The key of the set.
anInteger - <Integer> The number of members to pop.
Answers:
<Array> An array of the removed members.
<EsFuture> In async mode, a future that completes with the result.
srandmember:
Get one random member from a set.
Arguments:
aKey - <String> The key of the set.
Answers:
<String> A random member, or nil if the set is empty.
<EsFuture> In async mode, a future that completes with the result.
srandmember:count:
Get one or more random members from a set.
Arguments:
aKey - <String> The key of the set.
anInteger - <Integer> The number of members to return.
Answers:
<Array> An array of random members.
<EsFuture> In async mode, a future that completes with the result.
srem:members:
Remove one or more members from a set.
Arguments:
aKey - <String> The key of the set.
aMemberOrCollection - <Object | SequenceableCollection> The member or members to remove.
Answers:
<Integer> The number of members that were removed from the set.
<EsFuture> In async mode, a future that completes with the result.
sscan:cursor:
Incrementally iterate over members of a set.
Arguments:
aKey - <String> The key of the set.
aCursor - <String> The cursor.
Answers:
<Array> An array where the first element is the new cursor, and the second is an array of members.
<EsFuture> In async mode, a future that completes with the result.
sunion:
Add multiple sets.
Arguments:
aCollectionOfKeys - <SequenceableCollection> The keys of the sets to union.
Answers:
<Set> A set of members of the resulting set. The reply is
normalized to a Set for protocol consistency.
<EsFuture> In async mode, a future that completes with the result.
sunionstore:keys:
Add multiple sets and store the resulting set in a new key.
Arguments:
aDestKey - <String> The destination key.
aCollectionOfKeys - <Collection> The keys of the sets to union.
Answers:
<Integer> The number of elements in the resulting set.
<EsFuture> In async mode, a future that completes with the result.
Last modified date: 01/22/2026