From 4a093bdbfaa1e2ec610dc81f33add1cf5cf57aac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=AC=E4=B8=BD=E6=96=8C?= Date: Tue, 28 Sep 2021 11:19:15 +0800 Subject: [PATCH] fix sync call can not catch exception in async client --- src/CSRedisCore/CSRedisClientAsync.cs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/CSRedisCore/CSRedisClientAsync.cs b/src/CSRedisCore/CSRedisClientAsync.cs index ed0914e..55d9765 100644 --- a/src/CSRedisCore/CSRedisClientAsync.cs +++ b/src/CSRedisCore/CSRedisClientAsync.cs @@ -1784,7 +1784,7 @@ public Task LRemAsync(string key, long count, object value) async public Task LSetAsync(string key, long index, object value) { var args = this.SerializeRedisValueInternal(value); - return await ExecuteScalar(key, (c, k) => c.Value.LSetAsync(k, index, args)) == "OK"; + return await ExecuteScalarAsync(key, (c, k) => c.Value.LSetAsync(k, index, args)) == "OK"; } /// /// 对一个列表进行修剪,让列表只保留指定区间内的元素,不在指定区间之内的元素都将被删除 @@ -1845,7 +1845,7 @@ async public Task RPushAsync(string key, params T[] value) public Task RPushXAsync(string key, object value) { var args = this.SerializeRedisValueInternal(value); - return ExecuteScalar(key, (c, k) => c.Value.RPushXAsync(k, args)); + return ExecuteScalarAsync(key, (c, k) => c.Value.RPushXAsync(k, args)); } #endregion @@ -2221,10 +2221,10 @@ async public Task SetAsync(string key, object value, int expireSeconds = - async public Task SetAsync(string key, object value, TimeSpan expire, RedisExistence? exists = null) { object redisValule = this.SerializeRedisValueInternal(value); - if (expire <= TimeSpan.Zero && exists == null) return await ExecuteScalar(key, (c, k) => c.Value.SetAsync(k, redisValule)) == "OK"; - if (expire <= TimeSpan.Zero && exists != null) return await ExecuteScalar(key, (c, k) => c.Value.SetAsync(k, redisValule, null, exists)) == "OK"; - if (expire > TimeSpan.Zero && exists == null) return await ExecuteScalar(key, (c, k) => c.Value.SetAsync(k, redisValule, expire, null)) == "OK"; - if (expire > TimeSpan.Zero && exists != null) return await ExecuteScalar(key, (c, k) => c.Value.SetAsync(k, redisValule, expire, exists)) == "OK"; + if (expire <= TimeSpan.Zero && exists == null) return await ExecuteScalarAsync(key, (c, k) => c.Value.SetAsync(k, redisValule)) == "OK"; + if (expire <= TimeSpan.Zero && exists != null) return await ExecuteScalarAsync(key, (c, k) => c.Value.SetAsync(k, redisValule, null, exists)) == "OK"; + if (expire > TimeSpan.Zero && exists == null) return await ExecuteScalarAsync(key, (c, k) => c.Value.SetAsync(k, redisValule, expire, null)) == "OK"; + if (expire > TimeSpan.Zero && exists != null) return await ExecuteScalarAsync(key, (c, k) => c.Value.SetAsync(k, redisValule, expire, exists)) == "OK"; return false; } ///