Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added SetUnion, SetIntersect and SetDiff to IDatabase. All of them are used SetCombine method #2708

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
337 changes: 337 additions & 0 deletions src/StackExchange.Redis/Interfaces/IDatabase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1351,6 +1351,343 @@ public interface IDatabase : IRedis, IDatabaseAsync
/// <remarks><seealso href="https://redis.io/commands/sadd"/></remarks>
long SetAdd(RedisKey key, RedisValue[] values, CommandFlags flags = CommandFlags.None);

/// <summary>
/// Returns the members of the set resulting from the union operation against the given sets.
/// </summary>
/// <param name="first">The key of the first set.</param>
/// <param name="second">The key of the second set.</param>
/// <returns>List with members of the resulting set.</returns>
/// <remarks>
/// <seealso href="https://redis.io/commands/sunion"/>,
/// <seealso href="https://redis.io/commands/sinter"/>,
/// <seealso href="https://redis.io/commands/sdiff"/>
/// </remarks>
///
RedisValue[] SetUnion(RedisKey first, RedisKey second);

/// <summary>
/// Returns the members of the set resulting from the union operation against the given sets.
/// </summary>
/// <param name="first">The key of the first set.</param>
/// <param name="second">The key of the second set.</param>
/// <param name="flags">The flags to use for this operation.</param>
/// <returns>List with members of the resulting set.</returns>
/// <remarks>
/// <seealso href="https://redis.io/commands/sunion"/>,
/// <seealso href="https://redis.io/commands/sinter"/>,
/// <seealso href="https://redis.io/commands/sdiff"/>
/// </remarks>
RedisValue[] SetUnion(RedisKey first, RedisKey second, CommandFlags flags);

/// <summary>
/// Returns the members of the set resulting from the union operation against the given sets.
/// </summary>
/// <param name="keys">The keys of the sets to union.</param>
/// <returns>List with members of the resulting set.</returns>
/// <remarks>
/// <seealso href="https://redis.io/commands/sunion"/>,
/// <seealso href="https://redis.io/commands/sinter"/>,
/// <seealso href="https://redis.io/commands/sdiff"/>
/// </remarks>
RedisValue[] SetUnion(RedisKey[] keys);

/// <summary>
/// Returns the members of the set resulting from the union operation against the given sets.
/// </summary>
/// <param name="keys">The keys of the sets to union.</param>
/// <param name="flags">The flags to use for this operation.</param>
/// <returns>List with members of the resulting set.</returns>
/// <remarks>
/// <seealso href="https://redis.io/commands/sunion"/>,
/// <seealso href="https://redis.io/commands/sinter"/>,
/// <seealso href="https://redis.io/commands/sdiff"/>
/// </remarks>
RedisValue[] SetUnion(RedisKey[] keys, CommandFlags flags);

/// <summary>
/// This command is equal to SetUnion, but instead of returning the resulting set, it is stored in destination.
/// If destination already exists, it is overwritten.
/// </summary>
/// <param name="destination">The key of the destination set.</param>
/// <param name="first">The key of the first set.</param>
/// <param name="second">The key of the second set.</param>
/// <returns>The number of elements in the resulting set.</returns>
/// <remarks>
/// <seealso href="https://redis.io/commands/sunionstore"/>,
/// <seealso href="https://redis.io/commands/sinterstore"/>,
/// <seealso href="https://redis.io/commands/sdiffstore"/>
/// </remarks>
long SetUnionAndStore(RedisKey destination, RedisKey first, RedisKey second);

/// <summary>
/// This command is equal to SetUnion, but instead of returning the resulting set, it is stored in destination.
/// If destination already exists, it is overwritten.
/// </summary>
/// <param name="destination">The key of the destination set.</param>
/// <param name="first">The key of the first set.</param>
/// <param name="second">The key of the second set.</param>
/// <param name="flags">The flags to use for this operation.</param>
/// <returns>The number of elements in the resulting set.</returns>
/// <remarks>
/// <seealso href="https://redis.io/commands/sunionstore"/>,
/// <seealso href="https://redis.io/commands/sinterstore"/>,
/// <seealso href="https://redis.io/commands/sdiffstore"/>
/// </remarks>
long SetUnionAndStore(RedisKey destination, RedisKey first, RedisKey second, CommandFlags flags);

/// <summary>
/// This command is equal to SetUnion, but instead of returning the resulting set, it is stored in destination.
/// If destination already exists, it is overwritten.
/// </summary>
/// <param name="destination">The key of the destination set.</param>
/// <param name="keys">The keys of the sets to operate on.</param>
/// <returns>The number of elements in the resulting set.</returns>
/// <remarks>
/// <seealso href="https://redis.io/commands/sunionstore"/>,
/// <seealso href="https://redis.io/commands/sinterstore"/>,
/// <seealso href="https://redis.io/commands/sdiffstore"/>
/// </remarks>
long SetUnionAndStore(RedisKey destination, RedisKey[] keys);

/// <summary>
/// This command is equal to SetUnion, but instead of returning the resulting set, it is stored in destination.
/// If destination already exists, it is overwritten.
/// </summary>
/// <param name="destination">The key of the destination set.</param>
/// <param name="keys">The keys of the sets to operate on.</param>
/// <param name="flags">The flags to use for this operation.</param>
/// <returns>The number of elements in the resulting set.</returns>
/// <remarks>
/// <seealso href="https://redis.io/commands/sunionstore"/>,
/// <seealso href="https://redis.io/commands/sinterstore"/>,
/// <seealso href="https://redis.io/commands/sdiffstore"/>
/// </remarks>
long SetUnionAndStore(RedisKey destination, RedisKey[] keys, CommandFlags flags);

/// <summary>
/// Returns the members of the set resulting from the intersection operation against the given sets.
/// </summary>
/// <param name="first">The key of the first set.</param>
/// <param name="second">The key of the second set.</param>
/// <returns>List with members of the resulting set.</returns>
/// <remarks>
/// <seealso href="https://redis.io/commands/sunion"/>,
/// <seealso href="https://redis.io/commands/sinter"/>,
/// <seealso href="https://redis.io/commands/sdiff"/>
/// </remarks>
RedisValue[] SetIntersect(RedisKey first, RedisKey second);

/// <summary>
/// Returns the members of the set resulting from the intersection operation against the given sets.
/// </summary>
/// <param name="first">The key of the first set.</param>
/// <param name="second">The key of the second set.</param>
/// <param name="flags">The flags to use for this operation.</param>
/// <returns>List with members of the resulting set.</returns>
/// <remarks>
/// <seealso href="https://redis.io/commands/sunion"/>,
/// <seealso href="https://redis.io/commands/sinter"/>,
/// <seealso href="https://redis.io/commands/sdiff"/>
/// </remarks>
RedisValue[] SetIntersect(RedisKey first, RedisKey second, CommandFlags flags);

/// <summary>
/// Returns the members of the set resulting from the intersection operation against the given sets.
/// </summary>
/// <param name="keys">The keys of the sets to intersect.</param>
/// <returns>List with members of the resulting set.</returns>
/// <remarks>
/// <seealso href="https://redis.io/commands/sunion"/>,
/// <seealso href="https://redis.io/commands/sinter"/>,
/// <seealso href="https://redis.io/commands/sdiff"/>
/// </remarks>
RedisValue[] SetIntersect(RedisKey[] keys);

/// <summary>
/// Returns the members of the set resulting from the intersection operation against the given sets.
/// </summary>
/// <param name="keys">The keys of the sets to intersect.</param>
/// <param name="flags">The flags to use for this operation.</param>
/// <returns>List with members of the resulting set.</returns>
/// <remarks>
/// <seealso href="https://redis.io/commands/sunion"/>,
/// <seealso href="https://redis.io/commands/sinter"/>,
/// <seealso href="https://redis.io/commands/sdiff"/>
/// </remarks>
RedisValue[] SetIntersect(RedisKey[] keys, CommandFlags flags);

/// <summary>
/// This command is equal to SetIntersect, but instead of returning the resulting set, it is stored in destination.
/// If destination already exists, it is overwritten.
/// </summary>
/// <param name="destination">The key of the destination set.</param>
/// <param name="first">The key of the first set.</param>
/// <param name="second">The key of the second set.</param>
/// <returns>The number of elements in the resulting set.</returns>
/// <remarks>
/// <seealso href="https://redis.io/commands/sunionstore"/>,
/// <seealso href="https://redis.io/commands/sinterstore"/>,
/// <seealso href="https://redis.io/commands/sdiffstore"/>
/// </remarks>
long SetIntersectAndStore(RedisKey destination, RedisKey first, RedisKey second);

/// <summary>
/// This command is equal to SetIntersect, but instead of returning the resulting set, it is stored in destination.
/// If destination already exists, it is overwritten.
/// </summary>
/// <param name="destination">The key of the destination set.</param>
/// <param name="first">The key of the first set.</param>
/// <param name="second">The key of the second set.</param>
/// <param name="flags">The flags to use for this operation.</param>
/// <returns>The number of elements in the resulting set.</returns>
/// <remarks>
/// <seealso href="https://redis.io/commands/sunionstore"/>,
/// <seealso href="https://redis.io/commands/sinterstore"/>,
/// <seealso href="https://redis.io/commands/sdiffstore"/>
/// </remarks>
long SetIntersectAndStore(RedisKey destination, RedisKey first, RedisKey second, CommandFlags flags);

/// <summary>
/// This command is equal to SetIntersect, but instead of returning the resulting set, it is stored in destination.
/// If destination already exists, it is overwritten.
/// </summary>
/// <param name="destination">The key of the destination set.</param>
/// <param name="keys">The keys of the sets to operate on.</param>
/// <returns>The number of elements in the resulting set.</returns>
/// <remarks>
/// <seealso href="https://redis.io/commands/sunionstore"/>,
/// <seealso href="https://redis.io/commands/sinterstore"/>,
/// <seealso href="https://redis.io/commands/sdiffstore"/>
/// </remarks>
long SetIntersectAndStore(RedisKey destination, RedisKey[] keys);

/// <summary>
/// This command is equal to SetIntersect, but instead of returning the resulting set, it is stored in destination.
/// If destination already exists, it is overwritten.
/// </summary>
/// <param name="destination">The key of the destination set.</param>
/// <param name="keys">The keys of the sets to operate on.</param>
/// <param name="flags">The flags to use for this operation.</param>
/// <returns>The number of elements in the resulting set.</returns>
/// <remarks>
/// <seealso href="https://redis.io/commands/sunionstore"/>,
/// <seealso href="https://redis.io/commands/sinterstore"/>,
/// <seealso href="https://redis.io/commands/sdiffstore"/>
/// </remarks>
long SetIntersectAndStore(RedisKey destination, RedisKey[] keys, CommandFlags flags);

/// <summary>
/// Returns the members of the set resulting from the diff operation against the given sets.
/// </summary>
/// <param name="first">The key of the first set.</param>
/// <param name="second">The key of the second set.</param>
/// <returns>List with members of the resulting set.</returns>
/// <remarks>
/// <seealso href="https://redis.io/commands/sunion"/>,
/// <seealso href="https://redis.io/commands/sinter"/>,
/// <seealso href="https://redis.io/commands/sdiff"/>
/// </remarks>
RedisValue[] SetDiff(RedisKey first, RedisKey second);

/// <summary>
/// Returns the members of the set resulting from the diff operation against the given sets.
/// </summary>
/// <param name="first">The key of the first set.</param>
/// <param name="second">The key of the second set.</param>
/// <param name="flags">The flags to use for this operation.</param>
/// <returns>List with members of the resulting set.</returns>
/// <remarks>
/// <seealso href="https://redis.io/commands/sunion"/>,
/// <seealso href="https://redis.io/commands/sinter"/>,
/// <seealso href="https://redis.io/commands/sdiff"/>
/// </remarks>
RedisValue[] SetDiff(RedisKey first, RedisKey second, CommandFlags flags);

/// <summary>
/// Returns the members of the set resulting from the diff operation against the given sets.
/// </summary>
/// <param name="keys">The keys of the sets to diff.</param>
/// <returns>List with members of the resulting set.</returns>
/// <remarks>
/// <seealso href="https://redis.io/commands/sunion"/>,
/// <seealso href="https://redis.io/commands/sinter"/>,
/// <seealso href="https://redis.io/commands/sdiff"/>
/// </remarks>
RedisValue[] SetDiff(RedisKey[] keys);

/// <summary>
/// Returns the members of the set resulting from the diff operation against the given sets.
/// </summary>
/// <param name="keys">The keys of the sets to diff.</param>
/// <param name="flags">The flags to use for this operation.</param>
/// <returns>List with members of the resulting set.</returns>
/// <remarks>
/// <seealso href="https://redis.io/commands/sunion"/>,
/// <seealso href="https://redis.io/commands/sinter"/>,
/// <seealso href="https://redis.io/commands/sdiff"/>
/// </remarks>
RedisValue[] SetDiff(RedisKey[] keys, CommandFlags flags);

/// <summary>
/// This command is equal to SetDiff, but instead of returning the resulting set, it is stored in destination.
/// If destination already exists, it is overwritten.
/// </summary>
/// <param name="destination">The key of the destination set.</param>
/// <param name="first">The key of the first set.</param>
/// <param name="second">The key of the second set.</param>
/// <returns>The number of elements in the resulting set.</returns>
/// <remarks>
/// <seealso href="https://redis.io/commands/sunionstore"/>,
/// <seealso href="https://redis.io/commands/sinterstore"/>,
/// <seealso href="https://redis.io/commands/sdiffstore"/>
/// </remarks>
long SetDiffAndStore(RedisKey destination, RedisKey first, RedisKey second);

/// <summary>
/// This command is equal to SetDiff, but instead of returning the resulting set, it is stored in destination.
/// If destination already exists, it is overwritten.
/// </summary>
/// <param name="destination">The key of the destination set.</param>
/// <param name="first">The key of the first set.</param>
/// <param name="second">The key of the second set.</param>
/// <param name="flags">The flags to use for this operation.</param>
/// <returns>The number of elements in the resulting set.</returns>
/// <remarks>
/// <seealso href="https://redis.io/commands/sunionstore"/>,
/// <seealso href="https://redis.io/commands/sinterstore"/>,
/// <seealso href="https://redis.io/commands/sdiffstore"/>
/// </remarks>
long SetDiffAndStore(RedisKey destination, RedisKey first, RedisKey second, CommandFlags flags);

/// <summary>
/// This command is equal to SetDiff, but instead of returning the resulting set, it is stored in destination.
/// If destination already exists, it is overwritten.
/// </summary>
/// <param name="destination">The key of the destination set.</param>
/// <param name="keys">The keys of the sets to operate on.</param>
/// <returns>The number of elements in the resulting set.</returns>
/// <remarks>
/// <seealso href="https://redis.io/commands/sunionstore"/>,
/// <seealso href="https://redis.io/commands/sinterstore"/>,
/// <seealso href="https://redis.io/commands/sdiffstore"/>
/// </remarks>
long SetDiffAndStore(RedisKey destination, RedisKey[] keys);

/// <summary>
/// This command is equal to SetDiff, but instead of returning the resulting set, it is stored in destination.
/// If destination already exists, it is overwritten.
/// </summary>
/// <param name="destination">The key of the destination set.</param>
/// <param name="keys">The keys of the sets to operate on.</param>
/// <param name="flags">The flags to use for this operation.</param>
/// <returns>The number of elements in the resulting set.</returns>
/// <remarks>
/// <seealso href="https://redis.io/commands/sunionstore"/>,
/// <seealso href="https://redis.io/commands/sinterstore"/>,
/// <seealso href="https://redis.io/commands/sdiffstore"/>
/// </remarks>
long SetDiffAndStore(RedisKey destination, RedisKey[] keys, CommandFlags flags);

/// <summary>
/// Returns the members of the set resulting from the specified operation against the given sets.
/// </summary>
Expand Down
Loading
Loading