Reputation: 3746
I need to use some redis commands related to set operations. I am using StackExchange.Redis to connect to my redis server and perform the required operations. Specifically I need to perform the following operations
I am able to see SetAdd in the IDatabase interface but how can I get the SDIFF and SINTER command?
Upvotes: 3
Views: 1976
Reputation: 13089
You should use the method IDatabase.SetCombine()
for commands SDIFF, SUNION or SINTER.
/// <summary>
/// Returns the members of the set resulting from the specified operation against the given sets.
/// </summary>
/// <returns>list with members of the resulting set.</returns>
/// <remarks>http://redis.io/commands/sunion</remarks>
/// <remarks>http://redis.io/commands/sinter</remarks>
/// <remarks>http://redis.io/commands/sdiff</remarks>
RedisValue[] SetCombine(SetOperation operation, RedisKey first, RedisKey second, CommandFlags flags = CommandFlags.None);
Where SetOperation
can be Union
, Intersect
or Difference
Take a look at some of the tests
Upvotes: 5