From e496ec310cbe0c3178c045151a97b8444c9b2ac7 Mon Sep 17 00:00:00 2001 From: shacharPash Date: Thu, 24 Aug 2023 16:31:30 +0300 Subject: [PATCH 1/2] deprecated redisGraph --- src/NRedisStack/Graph/IGraphCommands.cs | 1 + src/NRedisStack/Graph/IGraphCommandsAsync.cs | 1 + 2 files changed, 2 insertions(+) diff --git a/src/NRedisStack/Graph/IGraphCommands.cs b/src/NRedisStack/Graph/IGraphCommands.cs index 8995d072..64ba041f 100644 --- a/src/NRedisStack/Graph/IGraphCommands.cs +++ b/src/NRedisStack/Graph/IGraphCommands.cs @@ -3,6 +3,7 @@ namespace NRedisStack { + [Obsolete("RedisGraph is not supported since Redis 7.2 (https://redis.com/blog/redisgraph-eol/)")] public interface IGraphCommands { /// diff --git a/src/NRedisStack/Graph/IGraphCommandsAsync.cs b/src/NRedisStack/Graph/IGraphCommandsAsync.cs index 7ea98ec8..a6d2d36d 100644 --- a/src/NRedisStack/Graph/IGraphCommandsAsync.cs +++ b/src/NRedisStack/Graph/IGraphCommandsAsync.cs @@ -3,6 +3,7 @@ namespace NRedisStack { + [Obsolete("RedisGraph is not supported since Redis 7.2 (https://redis.com/blog/redisgraph-eol/)")] public interface IGraphCommandsAsync { /// From e11fa057a279200a0b6f50085b352181375249da Mon Sep 17 00:00:00 2001 From: shacharPash Date: Thu, 24 Aug 2023 17:07:21 +0300 Subject: [PATCH 2/2] split TFCALL --- src/NRedisStack/Gears/GearsCommands.cs | 24 +++++++++++++++------ src/NRedisStack/Gears/GearsCommandsAsync.cs | 23 +++++++++++++++----- tests/NRedisStack.Tests/Gears/GearsTests.cs | 8 +++---- 3 files changed, 40 insertions(+), 15 deletions(-) diff --git a/src/NRedisStack/Gears/GearsCommands.cs b/src/NRedisStack/Gears/GearsCommands.cs index 9c0b890e..2eb885f0 100644 --- a/src/NRedisStack/Gears/GearsCommands.cs +++ b/src/NRedisStack/Gears/GearsCommands.cs @@ -48,19 +48,31 @@ public static Dictionary[] TFunctionList(this IDatabase db, } /// - /// Trigger a sync or async (Coroutine) function. + /// Trigger a sync function. /// /// The library name contains the function. /// The function name to run. /// keys that will be touched by the function. /// Additional argument to pass to the function. - /// If true, Invoke an async function (Coroutine). /// The return value from the sync & async function on error in case of failure. - /// //TODO: check this link when it's available - /// //TODO: check this link when it's available - public static RedisResult TFCall(this IDatabase db, string libraryName, string functionName, string[]? keys = null, string[]? args = null, bool async = false) + /// + public static RedisResult TFCall_(this IDatabase db, string libraryName, string functionName, string[]? keys = null, string[]? args = null) { - return db.Execute(GearsCommandBuilder.TFCall(libraryName, functionName, keys, args, async)); + return db.Execute(GearsCommandBuilder.TFCall(libraryName, functionName, keys, args, async : false)); + } + + /// + /// Trigger a async (Coroutine) function. + /// + /// The library name contains the function. + /// The function name to run. + /// keys that will be touched by the function. + /// Additional argument to pass to the function. + /// The return value from the sync & async function on error in case of failure. + /// + public static RedisResult TFCallAsync_(this IDatabase db, string libraryName, string functionName, string[]? keys = null, string[]? args = null) + { + return db.Execute(GearsCommandBuilder.TFCall(libraryName, functionName, keys, args, async : true)); } } } diff --git a/src/NRedisStack/Gears/GearsCommandsAsync.cs b/src/NRedisStack/Gears/GearsCommandsAsync.cs index c0b65912..4842a3ed 100644 --- a/src/NRedisStack/Gears/GearsCommandsAsync.cs +++ b/src/NRedisStack/Gears/GearsCommandsAsync.cs @@ -47,18 +47,31 @@ public static async Task[]> TFunctionListAsync(t } /// - /// Invoke a sync or async (Coroutine) function. + /// Trigger a sync function. /// /// The library name contains the function. /// The function name to run. /// keys that will be touched by the function. /// Additional argument to pass to the function. - /// If true, Invoke an async function (Coroutine). /// The return value from the sync & async function on error in case of failure. - /// //TODO: add link to the command when it's available - public static async Task TFCallAsync(this IDatabase db, string libraryName, string functionName, string[]? keys = null, string[]? args = null, bool async = false) + /// + public async static Task TFCall_Async(this IDatabase db, string libraryName, string functionName, string[]? keys = null, string[]? args = null) + { + return await db.ExecuteAsync(GearsCommandBuilder.TFCall(libraryName, functionName, keys, args, async : false)); + } + + /// + /// Trigger a async (Coroutine) function. + /// + /// The library name contains the function. + /// The function name to run. + /// keys that will be touched by the function. + /// Additional argument to pass to the function. + /// The return value from the sync & async function on error in case of failure. + /// + public async static Task TFCallAsync_Async(this IDatabase db, string libraryName, string functionName, string[]? keys = null, string[]? args = null) { - return await db.ExecuteAsync(GearsCommandBuilder.TFCall(libraryName, functionName, keys, args, async)); + return await db.ExecuteAsync(GearsCommandBuilder.TFCall(libraryName, functionName, keys, args, async : true)); } } } diff --git a/tests/NRedisStack.Tests/Gears/GearsTests.cs b/tests/NRedisStack.Tests/Gears/GearsTests.cs index 9651f53e..1cad0b15 100644 --- a/tests/NRedisStack.Tests/Gears/GearsTests.cs +++ b/tests/NRedisStack.Tests/Gears/GearsTests.cs @@ -103,8 +103,8 @@ public void TestTFCall() TryDeleteLib(db, "lib", "lib1", "lib2", "lib3"); Assert.True(db.TFunctionLoad(GenerateLibCode("lib"))); - Assert.Equal("bar", db.TFCall("lib", "foo", async: false).ToString()); - Assert.Equal("bar", db.TFCall("lib", "foo", async: true).ToString()); + Assert.Equal("bar", db.TFCall_("lib", "foo").ToString()); + Assert.Equal("bar", db.TFCallAsync_("lib", "foo").ToString()); Assert.True(db.TFunctionDelete("lib")); } @@ -117,8 +117,8 @@ public async Task TestTFCallAsync() TryDeleteLib(db, "lib", "lib1", "lib2", "lib3"); Assert.True(await db.TFunctionLoadAsync(GenerateLibCode("lib"))); - Assert.Equal("bar", (await db.TFCallAsync("lib", "foo", async: false)).ToString()); - Assert.Equal("bar", (await db.TFCallAsync("lib", "foo", async: true)).ToString()); + Assert.Equal("bar", (await db.TFCall_Async("lib", "foo")).ToString()); + Assert.Equal("bar", (await db.TFCallAsync_Async("lib", "foo")).ToString()); Assert.True(await db.TFunctionDeleteAsync("lib")); }