项目引用更新

This commit is contained in:
陈淳
2022-07-13 10:32:43 +08:00
parent 300d8224ec
commit 7fe9a6c900
17 changed files with 977 additions and 21 deletions

View File

@@ -22,8 +22,19 @@ namespace Yi.Framework.Core
{
this._RedisOptions = redisConnOptions.CurrentValue;
}
//public CSRedisClient GetClient()
//{
// return client;
//}
//private CSRedisClient client=null;
// 为了以后全链路做准备
private T TryCatch<T>(MyAction<T> 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
@@ -34,7 +45,9 @@ namespace Yi.Framework.Core
{
object p = null;
result = (T)p;
//isError = true;
Console.WriteLine(exinfo);
}
finally
{
@@ -55,6 +68,11 @@ namespace Yi.Framework.Core
return this.TryCatch((u) => u.Del(key));
}
public long HRemove(string key, params string[] par)
{
return this.TryCatch((u) => u.HDel(key, par));
}
public T Get<T>(string key)
{
return this.TryCatch<T>((u) => u.Get<T>(key));
@@ -68,9 +86,36 @@ namespace Yi.Framework.Core
{
return this.TryCatch<bool>((u) => u.Set(key, data));
}
public bool AddHash<T>(string key,string field, T data)
public T QueuePop<T>(string key)
{
return this.TryCatch<bool>((u)=>u.HSet(key ,field,data));
return this.TryCatch<T>((u) => u.RPop<T>(key));
}
public long QueuePush<T>(string key, T data)
{
return this.TryCatch<long>((u) => u.LPush<T>(key, data));
}
public long QueueLen(string key)
{
return TryCatch((u) => u.LLen(key));
}
public bool HSet<T>(string key, string fieId, T data)
{
return this.TryCatch<bool>((u) => u.HSet(key, fieId, data));
}
public bool HSet<T>(string key, string fieId, T data, TimeSpan time)
{
return this.TryCatch<bool>((u) =>
{
var res = u.HSet(key, fieId, data);
u.Expire(key, time);
return res;
});
}
public CSRedisClient Db()
{
return new CSRedisClient($"{_RedisOptions.Host}:{_RedisOptions.Prot},password={_RedisOptions.Password},defaultDatabase ={ _RedisOptions.DB }");
}
}
}

View File

@@ -18,8 +18,6 @@
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Yi.Framework.Common\Yi.Framework.Common.csproj" />
<ProjectReference Include="..\Yi.Framework.Model\Yi.Framework.Model.csproj" />
<ProjectReference Include="..\Yi.Framework.Task\Yi.Framework.Job.csproj" />
</ItemGroup>