From c77db1a2f9cd6cb53939ddd66d3bfdc024277d91 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=A9=99=E5=AD=90?= <454313500@qq.com> Date: Sun, 10 Apr 2022 19:25:49 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=93=8D=E4=BD=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Yi.Framework.Core/CacheClientDB.cs | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/Yi.Framework.Net6/Yi.Framework.Core/CacheClientDB.cs b/Yi.Framework.Net6/Yi.Framework.Core/CacheClientDB.cs index a5b6c3a3..5142f3e3 100644 --- a/Yi.Framework.Net6/Yi.Framework.Core/CacheClientDB.cs +++ b/Yi.Framework.Net6/Yi.Framework.Core/CacheClientDB.cs @@ -22,19 +22,8 @@ namespace Yi.Framework.Core { this._RedisOptions = redisConnOptions.CurrentValue; } - //public CSRedisClient GetClient() - //{ - // return client; - //} - //private CSRedisClient client=null; - - // 为了以后全链路做准备 - private T TryCatch(MyAction action) { - //Stopwatch sw = Stopwatch.StartNew(); - ////Exception ex = null; - ////bool isError = false; var client2 = new CSRedisClient($"{_RedisOptions.Host}:{_RedisOptions.Prot},password={_RedisOptions.Password},defaultDatabase ={ _RedisOptions.DB }"); T result; try @@ -45,9 +34,7 @@ namespace Yi.Framework.Core { object p = null; result = (T)p; - //isError = true; Console.WriteLine(exinfo); - } finally { @@ -81,5 +68,9 @@ namespace Yi.Framework.Core { return this.TryCatch((u) => u.Set(key, data)); } + public bool AddHash(string key,string field, T data) + { + return this.TryCatch((u)=>u.HSet(key ,field,data)); + } } }