From ee4f165bb8beae962d742180c47bb8ad5126b5ba Mon Sep 17 00:00:00 2001 From: mohsen bagheri Date: Tue, 30 Apr 2024 23:30:00 +0330 Subject: [PATCH 1/2] Added SetUnion, SetIntersect and SetDiff to IDatabase --- .../Interfaces/IDatabase.cs | 337 ++++++++++++++++++ .../Interfaces/IDatabaseAsync.cs | 337 ++++++++++++++++++ .../PublicAPI/PublicAPI.Unshipped.txt | 49 ++- src/StackExchange.Redis/RedisDatabase.cs | 240 +++++++++++++ 4 files changed, 962 insertions(+), 1 deletion(-) diff --git a/src/StackExchange.Redis/Interfaces/IDatabase.cs b/src/StackExchange.Redis/Interfaces/IDatabase.cs index e5c120eb9..e9bdfcc03 100644 --- a/src/StackExchange.Redis/Interfaces/IDatabase.cs +++ b/src/StackExchange.Redis/Interfaces/IDatabase.cs @@ -1351,6 +1351,343 @@ public interface IDatabase : IRedis, IDatabaseAsync /// long SetAdd(RedisKey key, RedisValue[] values, CommandFlags flags = CommandFlags.None); + /// + /// Returns the members of the set resulting from the union operation against the given sets. + /// + /// The key of the first set. + /// The key of the second set. + /// List with members of the resulting set. + /// + /// , + /// , + /// + /// + /// + RedisValue[] SetUnion(RedisKey first, RedisKey second); + + /// + /// Returns the members of the set resulting from the union operation against the given sets. + /// + /// The key of the first set. + /// The key of the second set. + /// The flags to use for this operation. + /// List with members of the resulting set. + /// + /// , + /// , + /// + /// + RedisValue[] SetUnion(RedisKey first, RedisKey second, CommandFlags flags); + + /// + /// Returns the members of the set resulting from the union operation against the given sets. + /// + /// The keys of the sets to union. + /// List with members of the resulting set. + /// + /// , + /// , + /// + /// + RedisValue[] SetUnion(RedisKey[] keys); + + /// + /// Returns the members of the set resulting from the union operation against the given sets. + /// + /// The keys of the sets to union. + /// The flags to use for this operation. + /// List with members of the resulting set. + /// + /// , + /// , + /// + /// + RedisValue[] SetUnion(RedisKey[] keys, CommandFlags flags); + + /// + /// 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. + /// + /// The key of the destination set. + /// The key of the first set. + /// The key of the second set. + /// The number of elements in the resulting set. + /// + /// , + /// , + /// + /// + long SetUnionAndStore(RedisKey destination, RedisKey first, RedisKey second); + + /// + /// 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. + /// + /// The key of the destination set. + /// The key of the first set. + /// The key of the second set. + /// The flags to use for this operation. + /// The number of elements in the resulting set. + /// + /// , + /// , + /// + /// + long SetUnionAndStore(RedisKey destination, RedisKey first, RedisKey second, CommandFlags flags); + + /// + /// 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. + /// + /// The key of the destination set. + /// The keys of the sets to operate on. + /// The number of elements in the resulting set. + /// + /// , + /// , + /// + /// + long SetUnionAndStore(RedisKey destination, RedisKey[] keys); + + /// + /// 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. + /// + /// The key of the destination set. + /// The keys of the sets to operate on. + /// The flags to use for this operation. + /// The number of elements in the resulting set. + /// + /// , + /// , + /// + /// + long SetUnionAndStore(RedisKey destination, RedisKey[] keys, CommandFlags flags); + + /// + /// Returns the members of the set resulting from the intersection operation against the given sets. + /// + /// The key of the first set. + /// The key of the second set. + /// List with members of the resulting set. + /// + /// , + /// , + /// + /// + RedisValue[] SetIntersect(RedisKey first, RedisKey second); + + /// + /// Returns the members of the set resulting from the intersection operation against the given sets. + /// + /// The key of the first set. + /// The key of the second set. + /// The flags to use for this operation. + /// List with members of the resulting set. + /// + /// , + /// , + /// + /// + RedisValue[] SetIntersect(RedisKey first, RedisKey second, CommandFlags flags); + + /// + /// Returns the members of the set resulting from the intersection operation against the given sets. + /// + /// The keys of the sets to intersect. + /// List with members of the resulting set. + /// + /// , + /// , + /// + /// + RedisValue[] SetIntersect(RedisKey[] keys); + + /// + /// Returns the members of the set resulting from the intersection operation against the given sets. + /// + /// The keys of the sets to intersect. + /// The flags to use for this operation. + /// List with members of the resulting set. + /// + /// , + /// , + /// + /// + RedisValue[] SetIntersect(RedisKey[] keys, CommandFlags flags); + + /// + /// 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. + /// + /// The key of the destination set. + /// The key of the first set. + /// The key of the second set. + /// The number of elements in the resulting set. + /// + /// , + /// , + /// + /// + long SetIntersectAndStore(RedisKey destination, RedisKey first, RedisKey second); + + /// + /// 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. + /// + /// The key of the destination set. + /// The key of the first set. + /// The key of the second set. + /// The flags to use for this operation. + /// The number of elements in the resulting set. + /// + /// , + /// , + /// + /// + long SetIntersectAndStore(RedisKey destination, RedisKey first, RedisKey second, CommandFlags flags); + + /// + /// 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. + /// + /// The key of the destination set. + /// The keys of the sets to operate on. + /// The number of elements in the resulting set. + /// + /// , + /// , + /// + /// + long SetIntersectAndStore(RedisKey destination, RedisKey[] keys); + + /// + /// 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. + /// + /// The key of the destination set. + /// The keys of the sets to operate on. + /// The flags to use for this operation. + /// The number of elements in the resulting set. + /// + /// , + /// , + /// + /// + long SetIntersectAndStore(RedisKey destination, RedisKey[] keys, CommandFlags flags); + + /// + /// Returns the members of the set resulting from the diff operation against the given sets. + /// + /// The key of the first set. + /// The key of the second set. + /// List with members of the resulting set. + /// + /// , + /// , + /// + /// + RedisValue[] SetDiff(RedisKey first, RedisKey second); + + /// + /// Returns the members of the set resulting from the diff operation against the given sets. + /// + /// The key of the first set. + /// The key of the second set. + /// The flags to use for this operation. + /// List with members of the resulting set. + /// + /// , + /// , + /// + /// + RedisValue[] SetDiff(RedisKey first, RedisKey second, CommandFlags flags); + + /// + /// Returns the members of the set resulting from the diff operation against the given sets. + /// + /// The keys of the sets to diff. + /// List with members of the resulting set. + /// + /// , + /// , + /// + /// + RedisValue[] SetDiff(RedisKey[] keys); + + /// + /// Returns the members of the set resulting from the diff operation against the given sets. + /// + /// The keys of the sets to diff. + /// The flags to use for this operation. + /// List with members of the resulting set. + /// + /// , + /// , + /// + /// + RedisValue[] SetDiff(RedisKey[] keys, CommandFlags flags); + + /// + /// 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. + /// + /// The key of the destination set. + /// The key of the first set. + /// The key of the second set. + /// The number of elements in the resulting set. + /// + /// , + /// , + /// + /// + long SetDiffAndStore(RedisKey destination, RedisKey first, RedisKey second); + + /// + /// 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. + /// + /// The key of the destination set. + /// The key of the first set. + /// The key of the second set. + /// The flags to use for this operation. + /// The number of elements in the resulting set. + /// + /// , + /// , + /// + /// + long SetDiffAndStore(RedisKey destination, RedisKey first, RedisKey second, CommandFlags flags); + + /// + /// 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. + /// + /// The key of the destination set. + /// The keys of the sets to operate on. + /// The number of elements in the resulting set. + /// + /// , + /// , + /// + /// + long SetDiffAndStore(RedisKey destination, RedisKey[] keys); + + /// + /// 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. + /// + /// The key of the destination set. + /// The keys of the sets to operate on. + /// The flags to use for this operation. + /// The number of elements in the resulting set. + /// + /// , + /// , + /// + /// + long SetDiffAndStore(RedisKey destination, RedisKey[] keys, CommandFlags flags); + /// /// Returns the members of the set resulting from the specified operation against the given sets. /// diff --git a/src/StackExchange.Redis/Interfaces/IDatabaseAsync.cs b/src/StackExchange.Redis/Interfaces/IDatabaseAsync.cs index 4a9cd400d..0531a50f8 100644 --- a/src/StackExchange.Redis/Interfaces/IDatabaseAsync.cs +++ b/src/StackExchange.Redis/Interfaces/IDatabaseAsync.cs @@ -1327,6 +1327,343 @@ public interface IDatabaseAsync : IRedisAsync /// Task SetAddAsync(RedisKey key, RedisValue[] values, CommandFlags flags = CommandFlags.None); + /// + /// Returns the members of the set resulting from the union operation against the given sets. + /// + /// The key of the first set. + /// The key of the second set. + /// List with members of the resulting set. + /// + /// , + /// , + /// + /// + /// + Task SetUnionAsync(RedisKey first, RedisKey second); + + /// + /// Returns the members of the set resulting from the union operation against the given sets. + /// + /// The key of the first set. + /// The key of the second set. + /// The flags to use for this operation. + /// List with members of the resulting set. + /// + /// , + /// , + /// + /// + Task SetUnionAsync(RedisKey first, RedisKey second, CommandFlags flags); + + /// + /// Returns the members of the set resulting from the union operation against the given sets. + /// + /// The keys of the sets to union. + /// List with members of the resulting set. + /// + /// , + /// , + /// + /// + Task SetUnionAsync(RedisKey[] keys); + + /// + /// Returns the members of the set resulting from the union operation against the given sets. + /// + /// The keys of the sets to union. + /// The flags to use for this operation. + /// List with members of the resulting set. + /// + /// , + /// , + /// + /// + Task SetUnionAsync(RedisKey[] keys, CommandFlags flags); + + /// + /// 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. + /// + /// The key of the destination set. + /// The key of the first set. + /// The key of the second set. + /// The number of elements in the resulting set. + /// + /// , + /// , + /// + /// + Task SetUnionAndStoreAsync(RedisKey destination, RedisKey first, RedisKey second); + + /// + /// 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. + /// + /// The key of the destination set. + /// The key of the first set. + /// The key of the second set. + /// The flags to use for this operation. + /// The number of elements in the resulting set. + /// + /// , + /// , + /// + /// + Task SetUnionAndStoreAsync(RedisKey destination, RedisKey first, RedisKey second, CommandFlags flags); + + /// + /// 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. + /// + /// The key of the destination set. + /// The keys of the sets to operate on. + /// The number of elements in the resulting set. + /// + /// , + /// , + /// + /// + Task SetUnionAndStoreAsync(RedisKey destination, RedisKey[] keys); + + /// + /// 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. + /// + /// The key of the destination set. + /// The keys of the sets to operate on. + /// The flags to use for this operation. + /// The number of elements in the resulting set. + /// + /// , + /// , + /// + /// + Task SetUnionAndStoreAsync(RedisKey destination, RedisKey[] keys, CommandFlags flags); + + /// + /// Returns the members of the set resulting from the intersection operation against the given sets. + /// + /// The key of the first set. + /// The key of the second set. + /// List with members of the resulting set. + /// + /// , + /// , + /// + /// + Task SetIntersectAsync(RedisKey first, RedisKey second); + + /// + /// Returns the members of the set resulting from the intersection operation against the given sets. + /// + /// The key of the first set. + /// The key of the second set. + /// The flags to use for this operation. + /// List with members of the resulting set. + /// + /// , + /// , + /// + /// + Task SetIntersectAsync(RedisKey first, RedisKey second, CommandFlags flags); + + /// + /// Returns the members of the set resulting from the intersection operation against the given sets. + /// + /// The keys of the sets to intersect. + /// List with members of the resulting set. + /// + /// , + /// , + /// + /// + Task SetIntersectAsync(RedisKey[] keys); + + /// + /// Returns the members of the set resulting from the intersection operation against the given sets. + /// + /// The keys of the sets to intersect. + /// The flags to use for this operation. + /// List with members of the resulting set. + /// + /// , + /// , + /// + /// + Task SetIntersectAsync(RedisKey[] keys, CommandFlags flags); + + /// + /// 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. + /// + /// The key of the destination set. + /// The key of the first set. + /// The key of the second set. + /// The number of elements in the resulting set. + /// + /// , + /// , + /// + /// + Task SetIntersectAndStoreAsync(RedisKey destination, RedisKey first, RedisKey second); + + /// + /// 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. + /// + /// The key of the destination set. + /// The key of the first set. + /// The key of the second set. + /// The flags to use for this operation. + /// The number of elements in the resulting set. + /// + /// , + /// , + /// + /// + Task SetIntersectAndStoreAsync(RedisKey destination, RedisKey first, RedisKey second, CommandFlags flags); + + /// + /// 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. + /// + /// The key of the destination set. + /// The keys of the sets to operate on. + /// The number of elements in the resulting set. + /// + /// , + /// , + /// + /// + Task SetIntersectAndStoreAsync(RedisKey destination, RedisKey[] keys); + + /// + /// 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. + /// + /// The key of the destination set. + /// The keys of the sets to operate on. + /// The flags to use for this operation. + /// The number of elements in the resulting set. + /// + /// , + /// , + /// + /// + Task SetIntersectAndStoreAsync(RedisKey destination, RedisKey[] keys, CommandFlags flags); + + /// + /// Returns the members of the set resulting from the diff operation against the given sets. + /// + /// The key of the first set. + /// The key of the second set. + /// List with members of the resulting set. + /// + /// , + /// , + /// + /// + Task SetDiffAsync(RedisKey first, RedisKey second); + + /// + /// Returns the members of the set resulting from the diff operation against the given sets. + /// + /// The key of the first set. + /// The key of the second set. + /// The flags to use for this operation. + /// List with members of the resulting set. + /// + /// , + /// , + /// + /// + Task SetDiffAsync(RedisKey first, RedisKey second, CommandFlags flags); + + /// + /// Returns the members of the set resulting from the diff operation against the given sets. + /// + /// The keys of the sets to diff. + /// List with members of the resulting set. + /// + /// , + /// , + /// + /// + Task SetDiffAsync(RedisKey[] keys); + + /// + /// Returns the members of the set resulting from the diff operation against the given sets. + /// + /// The keys of the sets to diff. + /// The flags to use for this operation. + /// List with members of the resulting set. + /// + /// , + /// , + /// + /// + Task SetDiffAsync(RedisKey[] keys, CommandFlags flags); + + /// + /// 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. + /// + /// The key of the destination set. + /// The key of the first set. + /// The key of the second set. + /// The number of elements in the resulting set. + /// + /// , + /// , + /// + /// + Task SetDiffAndStoreAsync(RedisKey destination, RedisKey first, RedisKey second); + + /// + /// 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. + /// + /// The key of the destination set. + /// The key of the first set. + /// The key of the second set. + /// The flags to use for this operation. + /// The number of elements in the resulting set. + /// + /// , + /// , + /// + /// + Task SetDiffAndStoreAsync(RedisKey destination, RedisKey first, RedisKey second, CommandFlags flags); + + /// + /// 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. + /// + /// The key of the destination set. + /// The keys of the sets to operate on. + /// The number of elements in the resulting set. + /// + /// , + /// , + /// + /// + Task SetDiffAndStoreAsync(RedisKey destination, RedisKey[] keys); + + /// + /// 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. + /// + /// The key of the destination set. + /// The keys of the sets to operate on. + /// The flags to use for this operation. + /// The number of elements in the resulting set. + /// + /// , + /// , + /// + /// + Task SetDiffAndStoreAsync(RedisKey destination, RedisKey[] keys, CommandFlags flags); + /// /// Returns the members of the set resulting from the specified operation against the given sets. /// diff --git a/src/StackExchange.Redis/PublicAPI/PublicAPI.Unshipped.txt b/src/StackExchange.Redis/PublicAPI/PublicAPI.Unshipped.txt index 5f282702b..4f3adac94 100644 --- a/src/StackExchange.Redis/PublicAPI/PublicAPI.Unshipped.txt +++ b/src/StackExchange.Redis/PublicAPI/PublicAPI.Unshipped.txt @@ -1 +1,48 @@ - \ No newline at end of file +StackExchange.Redis.IDatabase.SetDiff(StackExchange.Redis.RedisKey first, StackExchange.Redis.RedisKey second) -> StackExchange.Redis.RedisValue[]! +StackExchange.Redis.IDatabase.SetDiff(StackExchange.Redis.RedisKey first, StackExchange.Redis.RedisKey second, StackExchange.Redis.CommandFlags flags) -> StackExchange.Redis.RedisValue[]! +StackExchange.Redis.IDatabase.SetDiff(StackExchange.Redis.RedisKey[]! keys) -> StackExchange.Redis.RedisValue[]! +StackExchange.Redis.IDatabase.SetDiff(StackExchange.Redis.RedisKey[]! keys, StackExchange.Redis.CommandFlags flags) -> StackExchange.Redis.RedisValue[]! +StackExchange.Redis.IDatabase.SetDiffAndStore(StackExchange.Redis.RedisKey destination, StackExchange.Redis.RedisKey first, StackExchange.Redis.RedisKey second) -> long +StackExchange.Redis.IDatabase.SetDiffAndStore(StackExchange.Redis.RedisKey destination, StackExchange.Redis.RedisKey first, StackExchange.Redis.RedisKey second, StackExchange.Redis.CommandFlags flags) -> long +StackExchange.Redis.IDatabase.SetDiffAndStore(StackExchange.Redis.RedisKey destination, StackExchange.Redis.RedisKey[]! keys) -> long +StackExchange.Redis.IDatabase.SetDiffAndStore(StackExchange.Redis.RedisKey destination, StackExchange.Redis.RedisKey[]! keys, StackExchange.Redis.CommandFlags flags) -> long +StackExchange.Redis.IDatabase.SetIntersect(StackExchange.Redis.RedisKey first, StackExchange.Redis.RedisKey second) -> StackExchange.Redis.RedisValue[]! +StackExchange.Redis.IDatabase.SetIntersect(StackExchange.Redis.RedisKey first, StackExchange.Redis.RedisKey second, StackExchange.Redis.CommandFlags flags) -> StackExchange.Redis.RedisValue[]! +StackExchange.Redis.IDatabase.SetIntersect(StackExchange.Redis.RedisKey[]! keys) -> StackExchange.Redis.RedisValue[]! +StackExchange.Redis.IDatabase.SetIntersect(StackExchange.Redis.RedisKey[]! keys, StackExchange.Redis.CommandFlags flags) -> StackExchange.Redis.RedisValue[]! +StackExchange.Redis.IDatabase.SetIntersectAndStore(StackExchange.Redis.RedisKey destination, StackExchange.Redis.RedisKey first, StackExchange.Redis.RedisKey second) -> long +StackExchange.Redis.IDatabase.SetIntersectAndStore(StackExchange.Redis.RedisKey destination, StackExchange.Redis.RedisKey first, StackExchange.Redis.RedisKey second, StackExchange.Redis.CommandFlags flags) -> long +StackExchange.Redis.IDatabase.SetIntersectAndStore(StackExchange.Redis.RedisKey destination, StackExchange.Redis.RedisKey[]! keys) -> long +StackExchange.Redis.IDatabase.SetIntersectAndStore(StackExchange.Redis.RedisKey destination, StackExchange.Redis.RedisKey[]! keys, StackExchange.Redis.CommandFlags flags) -> long +StackExchange.Redis.IDatabase.SetUnion(StackExchange.Redis.RedisKey first, StackExchange.Redis.RedisKey second) -> StackExchange.Redis.RedisValue[]! +StackExchange.Redis.IDatabase.SetUnion(StackExchange.Redis.RedisKey first, StackExchange.Redis.RedisKey second, StackExchange.Redis.CommandFlags flags) -> StackExchange.Redis.RedisValue[]! +StackExchange.Redis.IDatabase.SetUnion(StackExchange.Redis.RedisKey[]! keys) -> StackExchange.Redis.RedisValue[]! +StackExchange.Redis.IDatabase.SetUnion(StackExchange.Redis.RedisKey[]! keys, StackExchange.Redis.CommandFlags flags) -> StackExchange.Redis.RedisValue[]! +StackExchange.Redis.IDatabase.SetUnionAndStore(StackExchange.Redis.RedisKey destination, StackExchange.Redis.RedisKey first, StackExchange.Redis.RedisKey second) -> long +StackExchange.Redis.IDatabase.SetUnionAndStore(StackExchange.Redis.RedisKey destination, StackExchange.Redis.RedisKey first, StackExchange.Redis.RedisKey second, StackExchange.Redis.CommandFlags flags) -> long +StackExchange.Redis.IDatabase.SetUnionAndStore(StackExchange.Redis.RedisKey destination, StackExchange.Redis.RedisKey[]! keys) -> long +StackExchange.Redis.IDatabase.SetUnionAndStore(StackExchange.Redis.RedisKey destination, StackExchange.Redis.RedisKey[]! keys, StackExchange.Redis.CommandFlags flags) -> long +StackExchange.Redis.IDatabaseAsync.SetDiffAndStoreAsync(StackExchange.Redis.RedisKey destination, StackExchange.Redis.RedisKey first, StackExchange.Redis.RedisKey second) -> System.Threading.Tasks.Task! +StackExchange.Redis.IDatabaseAsync.SetDiffAndStoreAsync(StackExchange.Redis.RedisKey destination, StackExchange.Redis.RedisKey first, StackExchange.Redis.RedisKey second, StackExchange.Redis.CommandFlags flags) -> System.Threading.Tasks.Task! +StackExchange.Redis.IDatabaseAsync.SetDiffAndStoreAsync(StackExchange.Redis.RedisKey destination, StackExchange.Redis.RedisKey[]! keys) -> System.Threading.Tasks.Task! +StackExchange.Redis.IDatabaseAsync.SetDiffAndStoreAsync(StackExchange.Redis.RedisKey destination, StackExchange.Redis.RedisKey[]! keys, StackExchange.Redis.CommandFlags flags) -> System.Threading.Tasks.Task! +StackExchange.Redis.IDatabaseAsync.SetDiffAsync(StackExchange.Redis.RedisKey first, StackExchange.Redis.RedisKey second) -> System.Threading.Tasks.Task! +StackExchange.Redis.IDatabaseAsync.SetDiffAsync(StackExchange.Redis.RedisKey first, StackExchange.Redis.RedisKey second, StackExchange.Redis.CommandFlags flags) -> System.Threading.Tasks.Task! +StackExchange.Redis.IDatabaseAsync.SetDiffAsync(StackExchange.Redis.RedisKey[]! keys) -> System.Threading.Tasks.Task! +StackExchange.Redis.IDatabaseAsync.SetDiffAsync(StackExchange.Redis.RedisKey[]! keys, StackExchange.Redis.CommandFlags flags) -> System.Threading.Tasks.Task! +StackExchange.Redis.IDatabaseAsync.SetIntersectAndStoreAsync(StackExchange.Redis.RedisKey destination, StackExchange.Redis.RedisKey first, StackExchange.Redis.RedisKey second) -> System.Threading.Tasks.Task! +StackExchange.Redis.IDatabaseAsync.SetIntersectAndStoreAsync(StackExchange.Redis.RedisKey destination, StackExchange.Redis.RedisKey first, StackExchange.Redis.RedisKey second, StackExchange.Redis.CommandFlags flags) -> System.Threading.Tasks.Task! +StackExchange.Redis.IDatabaseAsync.SetIntersectAndStoreAsync(StackExchange.Redis.RedisKey destination, StackExchange.Redis.RedisKey[]! keys) -> System.Threading.Tasks.Task! +StackExchange.Redis.IDatabaseAsync.SetIntersectAndStoreAsync(StackExchange.Redis.RedisKey destination, StackExchange.Redis.RedisKey[]! keys, StackExchange.Redis.CommandFlags flags) -> System.Threading.Tasks.Task! +StackExchange.Redis.IDatabaseAsync.SetIntersectAsync(StackExchange.Redis.RedisKey first, StackExchange.Redis.RedisKey second) -> System.Threading.Tasks.Task! +StackExchange.Redis.IDatabaseAsync.SetIntersectAsync(StackExchange.Redis.RedisKey first, StackExchange.Redis.RedisKey second, StackExchange.Redis.CommandFlags flags) -> System.Threading.Tasks.Task! +StackExchange.Redis.IDatabaseAsync.SetIntersectAsync(StackExchange.Redis.RedisKey[]! keys) -> System.Threading.Tasks.Task! +StackExchange.Redis.IDatabaseAsync.SetIntersectAsync(StackExchange.Redis.RedisKey[]! keys, StackExchange.Redis.CommandFlags flags) -> System.Threading.Tasks.Task! +StackExchange.Redis.IDatabaseAsync.SetUnionAndStoreAsync(StackExchange.Redis.RedisKey destination, StackExchange.Redis.RedisKey first, StackExchange.Redis.RedisKey second) -> System.Threading.Tasks.Task! +StackExchange.Redis.IDatabaseAsync.SetUnionAndStoreAsync(StackExchange.Redis.RedisKey destination, StackExchange.Redis.RedisKey first, StackExchange.Redis.RedisKey second, StackExchange.Redis.CommandFlags flags) -> System.Threading.Tasks.Task! +StackExchange.Redis.IDatabaseAsync.SetUnionAndStoreAsync(StackExchange.Redis.RedisKey destination, StackExchange.Redis.RedisKey[]! keys) -> System.Threading.Tasks.Task! +StackExchange.Redis.IDatabaseAsync.SetUnionAndStoreAsync(StackExchange.Redis.RedisKey destination, StackExchange.Redis.RedisKey[]! keys, StackExchange.Redis.CommandFlags flags) -> System.Threading.Tasks.Task! +StackExchange.Redis.IDatabaseAsync.SetUnionAsync(StackExchange.Redis.RedisKey first, StackExchange.Redis.RedisKey second) -> System.Threading.Tasks.Task! +StackExchange.Redis.IDatabaseAsync.SetUnionAsync(StackExchange.Redis.RedisKey first, StackExchange.Redis.RedisKey second, StackExchange.Redis.CommandFlags flags) -> System.Threading.Tasks.Task! +StackExchange.Redis.IDatabaseAsync.SetUnionAsync(StackExchange.Redis.RedisKey[]! keys) -> System.Threading.Tasks.Task! +StackExchange.Redis.IDatabaseAsync.SetUnionAsync(StackExchange.Redis.RedisKey[]! keys, StackExchange.Redis.CommandFlags flags) -> System.Threading.Tasks.Task! \ No newline at end of file diff --git a/src/StackExchange.Redis/RedisDatabase.cs b/src/StackExchange.Redis/RedisDatabase.cs index 6a0210e6b..e6d307ea7 100644 --- a/src/StackExchange.Redis/RedisDatabase.cs +++ b/src/StackExchange.Redis/RedisDatabase.cs @@ -1633,6 +1633,246 @@ public Task SetAddAsync(RedisKey key, RedisValue[] values, CommandFlags fl return ExecuteAsync(msg, ResultProcessor.Int64); } + public RedisValue[] SetUnion(RedisKey first, RedisKey second) + { + return SetCombine(SetOperation.Union, first, second); + } + + public RedisValue[] SetUnion(RedisKey first, RedisKey second, CommandFlags flags) + { + return SetCombine(SetOperation.Union, first, second, flags); + } + + public RedisValue[] SetUnion(RedisKey[] keys) + { + return SetCombine(SetOperation.Union, keys); + } + + public RedisValue[] SetUnion(RedisKey[] keys, CommandFlags flags) + { + return SetCombine(SetOperation.Union, keys, flags); + } + + public long SetUnionAndStore(RedisKey destination, RedisKey first, RedisKey second) + { + return SetCombineAndStore(SetOperation.Union, destination, first, second); + } + + public long SetUnionAndStore(RedisKey destination, RedisKey first, RedisKey second, CommandFlags flags) + { + return SetCombineAndStore(SetOperation.Union, destination, first, second, flags); + } + + public long SetUnionAndStore(RedisKey destination, RedisKey[] keys) + { + return SetCombineAndStore(SetOperation.Union, destination, keys); + } + + public long SetUnionAndStore(RedisKey destination, RedisKey[] keys, CommandFlags flags) + { + return SetCombineAndStore(SetOperation.Union, destination, keys, flags); + } + + public Task SetUnionAsync(RedisKey first, RedisKey second) + { + return SetCombineAsync(SetOperation.Union, first, second); + } + + public Task SetUnionAsync(RedisKey first, RedisKey second, CommandFlags flags) + { + return SetCombineAsync(SetOperation.Union, first, second, flags); + } + + public Task SetUnionAsync(RedisKey[] keys) + { + return SetCombineAsync(SetOperation.Union, keys); + } + + public Task SetUnionAsync(RedisKey[] keys, CommandFlags flags) + { + return SetCombineAsync(SetOperation.Union, keys, flags); + } + + public Task SetUnionAndStoreAsync(RedisKey destination, RedisKey first, RedisKey second) + { + return SetCombineAndStoreAsync(SetOperation.Union, destination, first, second); + } + + public Task SetUnionAndStoreAsync(RedisKey destination, RedisKey first, RedisKey second, CommandFlags flags) + { + return SetCombineAndStoreAsync(SetOperation.Union, destination, first, second, flags); + } + + public Task SetUnionAndStoreAsync(RedisKey destination, RedisKey[] keys) + { + return SetCombineAndStoreAsync(SetOperation.Union, destination, keys); + } + + public Task SetUnionAndStoreAsync(RedisKey destination, RedisKey[] keys, CommandFlags flags) + { + return SetCombineAndStoreAsync(SetOperation.Union, destination, keys, flags); + } + + public RedisValue[] SetIntersect(RedisKey first, RedisKey second) + { + return SetCombine(SetOperation.Intersect, first, second); + } + + public RedisValue[] SetIntersect(RedisKey first, RedisKey second, CommandFlags flags) + { + return SetCombine(SetOperation.Intersect, first, second, flags); + } + + public RedisValue[] SetIntersect(RedisKey[] keys) + { + return SetCombine(SetOperation.Intersect, keys); + } + + public RedisValue[] SetIntersect(RedisKey[] keys, CommandFlags flags) + { + return SetCombine(SetOperation.Intersect, keys, flags); + } + + public long SetIntersectAndStore(RedisKey destination, RedisKey first, RedisKey second) + { + return SetCombineAndStore(SetOperation.Intersect, destination, first, second); + } + + public long SetIntersectAndStore(RedisKey destination, RedisKey first, RedisKey second, CommandFlags flags) + { + return SetCombineAndStore(SetOperation.Intersect, destination, first, second, flags); + } + + public long SetIntersectAndStore(RedisKey destination, RedisKey[] keys) + { + return SetCombineAndStore(SetOperation.Intersect, destination, keys); + } + + public long SetIntersectAndStore(RedisKey destination, RedisKey[] keys, CommandFlags flags) + { + return SetCombineAndStore(SetOperation.Intersect, destination, keys, flags); + } + + public Task SetIntersectAsync(RedisKey first, RedisKey second) + { + return SetCombineAsync(SetOperation.Intersect, first, second); + } + + public Task SetIntersectAsync(RedisKey first, RedisKey second, CommandFlags flags) + { + return SetCombineAsync(SetOperation.Intersect, first, second, flags); + } + + public Task SetIntersectAsync(RedisKey[] keys) + { + return SetCombineAsync(SetOperation.Intersect, keys); + } + + public Task SetIntersectAsync(RedisKey[] keys, CommandFlags flags) + { + return SetCombineAsync(SetOperation.Intersect, keys, flags); + } + + public Task SetIntersectAndStoreAsync(RedisKey destination, RedisKey first, RedisKey second) + { + return SetCombineAndStoreAsync(SetOperation.Intersect, destination, first, second); + } + + public Task SetIntersectAndStoreAsync(RedisKey destination, RedisKey first, RedisKey second, CommandFlags flags) + { + return SetCombineAndStoreAsync(SetOperation.Intersect, destination, first, second, flags); + } + + public Task SetIntersectAndStoreAsync(RedisKey destination, RedisKey[] keys) + { + return SetCombineAndStoreAsync(SetOperation.Intersect, destination, keys); + } + + public Task SetIntersectAndStoreAsync(RedisKey destination, RedisKey[] keys, CommandFlags flags) + { + return SetCombineAndStoreAsync(SetOperation.Intersect, destination, keys, flags); + } + + public RedisValue[] SetDiff(RedisKey first, RedisKey second) + { + return SetCombine(SetOperation.Difference, first, second); + } + + public RedisValue[] SetDiff(RedisKey first, RedisKey second, CommandFlags flags) + { + return SetCombine(SetOperation.Difference, first, second, flags); + } + + public RedisValue[] SetDiff(RedisKey[] keys) + { + return SetCombine(SetOperation.Difference, keys); + } + + public RedisValue[] SetDiff(RedisKey[] keys, CommandFlags flags) + { + return SetCombine(SetOperation.Difference, keys, flags); + } + + public long SetDiffAndStore(RedisKey destination, RedisKey first, RedisKey second) + { + return SetCombineAndStore(SetOperation.Difference, destination, first, second); + } + + public long SetDiffAndStore(RedisKey destination, RedisKey first, RedisKey second, CommandFlags flags) + { + return SetCombineAndStore(SetOperation.Difference, destination, first, second, flags); + } + + public long SetDiffAndStore(RedisKey destination, RedisKey[] keys) + { + return SetCombineAndStore(SetOperation.Difference, destination, keys); + } + + public long SetDiffAndStore(RedisKey destination, RedisKey[] keys, CommandFlags flags) + { + return SetCombineAndStore(SetOperation.Difference, destination, keys, flags); + } + + public Task SetDiffAsync(RedisKey first, RedisKey second) + { + return SetCombineAsync(SetOperation.Difference, first, second); + } + + public Task SetDiffAsync(RedisKey first, RedisKey second, CommandFlags flags) + { + return SetCombineAsync(SetOperation.Difference, first, second, flags); + } + + public Task SetDiffAsync(RedisKey[] keys) + { + return SetCombineAsync(SetOperation.Difference, keys); + } + + public Task SetDiffAsync(RedisKey[] keys, CommandFlags flags) + { + return SetCombineAsync(SetOperation.Difference, keys, flags); + } + + public Task SetDiffAndStoreAsync(RedisKey destination, RedisKey first, RedisKey second) + { + return SetCombineAndStoreAsync(SetOperation.Difference, destination, first, second); + } + + public Task SetDiffAndStoreAsync(RedisKey destination, RedisKey first, RedisKey second, CommandFlags flags) + { + return SetCombineAndStoreAsync(SetOperation.Difference, destination, first, second, flags); + } + + public Task SetDiffAndStoreAsync(RedisKey destination, RedisKey[] keys) + { + return SetCombineAndStoreAsync(SetOperation.Difference, destination, keys); + } + + public Task SetDiffAndStoreAsync(RedisKey destination, RedisKey[] keys, CommandFlags flags) + { + return SetCombineAndStoreAsync(SetOperation.Difference, destination, keys, flags); + } + public RedisValue[] SetCombine(SetOperation operation, RedisKey first, RedisKey second, CommandFlags flags = CommandFlags.None) { var msg = Message.Create(Database, flags, SetOperationCommand(operation, false), first, second); From 9cac26ceed3dc29401500a674108d948e819ba7f Mon Sep 17 00:00:00 2001 From: mohsen bagheri Date: Tue, 30 Apr 2024 23:59:09 +0330 Subject: [PATCH 2/2] Implement SetUnion, SetIntersect and SetDiff in KeyPrefixed and KeyPrefixedDatabase --- .../KeyspaceIsolation/KeyPrefixed.cs | 72 ++++++++++++++++++ .../KeyspaceIsolation/KeyPrefixedDatabase.cs | 73 +++++++++++++++++++ 2 files changed, 145 insertions(+) diff --git a/src/StackExchange.Redis/KeyspaceIsolation/KeyPrefixed.cs b/src/StackExchange.Redis/KeyspaceIsolation/KeyPrefixed.cs index e34cad895..3501a394d 100644 --- a/src/StackExchange.Redis/KeyspaceIsolation/KeyPrefixed.cs +++ b/src/StackExchange.Redis/KeyspaceIsolation/KeyPrefixed.cs @@ -358,6 +358,78 @@ public Task SetAddAsync(RedisKey key, RedisValue[] values, CommandFlags fl public Task SetAddAsync(RedisKey key, RedisValue value, CommandFlags flags = CommandFlags.None) => Inner.SetAddAsync(ToInner(key), value, flags); + public Task SetUnionAsync(RedisKey first, RedisKey second) => + Inner.SetUnionAsync(ToInner(first), ToInner(second)); + + public Task SetUnionAsync(RedisKey first, RedisKey second, CommandFlags flags) => + Inner.SetUnionAsync(ToInner(first), ToInner(second), flags); + + public Task SetUnionAsync(RedisKey[] keys) => + Inner.SetUnionAsync(ToInner(keys)); + + public Task SetUnionAsync(RedisKey[] keys, CommandFlags flags) => + Inner.SetUnionAsync(ToInner(keys), flags); + + public Task SetUnionAndStoreAsync(RedisKey destination, RedisKey first, RedisKey second) => + Inner.SetUnionAndStoreAsync(ToInner(destination), ToInner(first), ToInner(second)); + + public Task SetUnionAndStoreAsync(RedisKey destination, RedisKey first, RedisKey second, CommandFlags flags) => + Inner.SetUnionAndStoreAsync(ToInner(destination), ToInner(first), ToInner(second), flags); + + public Task SetUnionAndStoreAsync(RedisKey destination, RedisKey[] keys) => + Inner.SetUnionAndStoreAsync(ToInner(destination), ToInner(keys)); + + public Task SetUnionAndStoreAsync(RedisKey destination, RedisKey[] keys, CommandFlags flags) => + Inner.SetUnionAndStoreAsync(ToInner(destination), ToInner(keys), flags); + + public Task SetIntersectAsync(RedisKey first, RedisKey second) => + Inner.SetIntersectAsync(ToInner(first), ToInner(second)); + + public Task SetIntersectAsync(RedisKey first, RedisKey second, CommandFlags flags) => + Inner.SetIntersectAsync(ToInner(first), ToInner(second), flags); + + public Task SetIntersectAsync(RedisKey[] keys) => + Inner.SetIntersectAsync(ToInner(keys)); + + public Task SetIntersectAsync(RedisKey[] keys, CommandFlags flags) => + Inner.SetIntersectAsync(ToInner(keys), flags); + + public Task SetIntersectAndStoreAsync(RedisKey destination, RedisKey first, RedisKey second) => + Inner.SetIntersectAndStoreAsync(ToInner(destination), ToInner(first), ToInner(second)); + + public Task SetIntersectAndStoreAsync(RedisKey destination, RedisKey first, RedisKey second, CommandFlags flags) => + Inner.SetIntersectAndStoreAsync(ToInner(destination), ToInner(first), ToInner(second), flags); + + public Task SetIntersectAndStoreAsync(RedisKey destination, RedisKey[] keys) => + Inner.SetIntersectAndStoreAsync(ToInner(destination), ToInner(keys)); + + public Task SetIntersectAndStoreAsync(RedisKey destination, RedisKey[] keys, CommandFlags flags) => + Inner.SetIntersectAndStoreAsync(ToInner(destination), ToInner(keys), flags); + + public Task SetDiffAsync(RedisKey first, RedisKey second) => + Inner.SetDiffAsync(ToInner(first), ToInner(second)); + + public Task SetDiffAsync(RedisKey first, RedisKey second, CommandFlags flags) => + Inner.SetDiffAsync(ToInner(first), ToInner(second), flags); + + public Task SetDiffAsync(RedisKey[] keys) => + Inner.SetDiffAsync(ToInner(keys)); + + public Task SetDiffAsync(RedisKey[] keys, CommandFlags flags) => + Inner.SetDiffAsync(ToInner(keys), flags); + + public Task SetDiffAndStoreAsync(RedisKey destination, RedisKey first, RedisKey second) => + Inner.SetDiffAndStoreAsync(ToInner(destination), ToInner(first), ToInner(second)); + + public Task SetDiffAndStoreAsync(RedisKey destination, RedisKey first, RedisKey second, CommandFlags flags) => + Inner.SetDiffAndStoreAsync(ToInner(destination), ToInner(first), ToInner(second), flags); + + public Task SetDiffAndStoreAsync(RedisKey destination, RedisKey[] keys) => + Inner.SetDiffAndStoreAsync(ToInner(destination), ToInner(keys)); + + public Task SetDiffAndStoreAsync(RedisKey destination, RedisKey[] keys, CommandFlags flags) => + Inner.SetDiffAndStoreAsync(ToInner(destination), ToInner(keys), flags); + public Task SetCombineAndStoreAsync(SetOperation operation, RedisKey destination, RedisKey[] keys, CommandFlags flags = CommandFlags.None) => Inner.SetCombineAndStoreAsync(operation, ToInner(destination), ToInner(keys), flags); diff --git a/src/StackExchange.Redis/KeyspaceIsolation/KeyPrefixedDatabase.cs b/src/StackExchange.Redis/KeyspaceIsolation/KeyPrefixedDatabase.cs index d1c47aeab..05f8ba888 100644 --- a/src/StackExchange.Redis/KeyspaceIsolation/KeyPrefixedDatabase.cs +++ b/src/StackExchange.Redis/KeyspaceIsolation/KeyPrefixedDatabase.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.Net; +using System.Threading.Tasks; namespace StackExchange.Redis.KeyspaceIsolation { @@ -347,6 +348,78 @@ public long SetAdd(RedisKey key, RedisValue[] values, CommandFlags flags = Comma public bool SetAdd(RedisKey key, RedisValue value, CommandFlags flags = CommandFlags.None) => Inner.SetAdd(ToInner(key), value, flags); + public RedisValue[] SetUnion(RedisKey first, RedisKey second) => + Inner.SetUnion(ToInner(first), ToInner(second)); + + public RedisValue[] SetUnion(RedisKey first, RedisKey second, CommandFlags flags) => + Inner.SetUnion(ToInner(first), ToInner(second), flags); + + public RedisValue[] SetUnion(RedisKey[] keys) => + Inner.SetUnion(ToInner(keys)); + + public RedisValue[] SetUnion(RedisKey[] keys, CommandFlags flags) => + Inner.SetUnion(ToInner(keys), flags); + + public long SetUnionAndStore(RedisKey destination, RedisKey first, RedisKey second) => + Inner.SetUnionAndStore(ToInner(destination), ToInner(first), ToInner(second)); + + public long SetUnionAndStore(RedisKey destination, RedisKey first, RedisKey second, CommandFlags flags) => + Inner.SetUnionAndStore(ToInner(destination), ToInner(first), ToInner(second), flags); + + public long SetUnionAndStore(RedisKey destination, RedisKey[] keys) => + Inner.SetUnionAndStore(ToInner(destination), ToInner(keys)); + + public long SetUnionAndStore(RedisKey destination, RedisKey[] keys, CommandFlags flags) => + Inner.SetUnionAndStore(ToInner(destination), ToInner(keys), flags); + + public RedisValue[] SetIntersect(RedisKey first, RedisKey second) => + Inner.SetIntersect(ToInner(first), ToInner(second)); + + public RedisValue[] SetIntersect(RedisKey first, RedisKey second, CommandFlags flags) => + Inner.SetIntersect(ToInner(first), ToInner(second), flags); + + public RedisValue[] SetIntersect(RedisKey[] keys) => + Inner.SetIntersect(ToInner(keys)); + + public RedisValue[] SetIntersect(RedisKey[] keys, CommandFlags flags) => + Inner.SetIntersect(ToInner(keys), flags); + + public long SetIntersectAndStore(RedisKey destination, RedisKey first, RedisKey second) => + Inner.SetIntersectAndStore(ToInner(destination), ToInner(first), ToInner(second)); + + public long SetIntersectAndStore(RedisKey destination, RedisKey first, RedisKey second, CommandFlags flags) => + Inner.SetIntersectAndStore(ToInner(destination), ToInner(first), ToInner(second), flags); + + public long SetIntersectAndStore(RedisKey destination, RedisKey[] keys) => + Inner.SetIntersectAndStore(ToInner(destination), ToInner(keys)); + + public long SetIntersectAndStore(RedisKey destination, RedisKey[] keys, CommandFlags flags) => + Inner.SetIntersectAndStore(ToInner(destination), ToInner(keys), flags); + + public RedisValue[] SetDiff(RedisKey first, RedisKey second) => + Inner.SetDiff(ToInner(first), ToInner(second)); + + public RedisValue[] SetDiff(RedisKey first, RedisKey second, CommandFlags flags) => + Inner.SetDiff(ToInner(first), ToInner(second), flags); + + public RedisValue[] SetDiff(RedisKey[] keys) => + Inner.SetDiff(ToInner(keys)); + + public RedisValue[] SetDiff(RedisKey[] keys, CommandFlags flags) => + Inner.SetDiff(ToInner(keys), flags); + + public long SetDiffAndStore(RedisKey destination, RedisKey first, RedisKey second) => + Inner.SetDiffAndStore(ToInner(destination), ToInner(first), ToInner(second)); + + public long SetDiffAndStore(RedisKey destination, RedisKey first, RedisKey second, CommandFlags flags) => + Inner.SetDiffAndStore(ToInner(destination), ToInner(first), ToInner(second), flags); + + public long SetDiffAndStore(RedisKey destination, RedisKey[] keys) => + Inner.SetDiffAndStore(ToInner(destination), ToInner(keys)); + + public long SetDiffAndStore(RedisKey destination, RedisKey[] keys, CommandFlags flags) => + Inner.SetDiffAndStore(ToInner(destination), ToInner(keys), flags); + public long SetCombineAndStore(SetOperation operation, RedisKey destination, RedisKey[] keys, CommandFlags flags = CommandFlags.None) => Inner.SetCombineAndStore(operation, ToInner(destination), ToInner(keys), flags);