diff --git a/Framework/YLErp.Cache/IYLCache.cs b/Framework/YLErp.Cache/IYLCache.cs index dc37752c..e0939b22 100644 --- a/Framework/YLErp.Cache/IYLCache.cs +++ b/Framework/YLErp.Cache/IYLCache.cs @@ -18,6 +18,16 @@ namespace YLErp.Cache /// bool DeleteKey(string key); + /// + /// Hash数据类型的保存 + /// + /// + /// + /// + /// + /// + bool HashSet(string key, string hashKey, T value); + /// /// 字符串数据类型的保存 /// diff --git a/Framework/YLErp.Cache/YLRedisCache.cs b/Framework/YLErp.Cache/YLRedisCache.cs index 93c9d3f0..aae50a6d 100644 --- a/Framework/YLErp.Cache/YLRedisCache.cs +++ b/Framework/YLErp.Cache/YLRedisCache.cs @@ -54,6 +54,11 @@ namespace YLErp.Cache return db.StringSet(GenerateKey(key), value); } + public bool HashSet(string key, string hashKey, T value) + { + return db.HashSet(key, hashKey, JsonConvert.SerializeObject(value)); + } + public string StringGet(string key) { return db.StringGet(GenerateKey(key)); diff --git a/YLWinSer/RealTimeCalcPositionService/ClientNoDMABalanceTask.cs b/YLWinSer/RealTimeCalcPositionService/ClientNoDMABalanceTask.cs index b0cd9f53..6dd124be 100644 --- a/YLWinSer/RealTimeCalcPositionService/ClientNoDMABalanceTask.cs +++ b/YLWinSer/RealTimeCalcPositionService/ClientNoDMABalanceTask.cs @@ -81,6 +81,7 @@ namespace RealTimeCalcPositionService if (_yLCache != null) { _yLCache.StringSet("ClientBalance:" + cb.ClientId, obj); + _yLCache.HashSet("risk:cash:balance:amount", cb.ClientId.ToString(), (decimal)obj.AvailableAmount); } } catch (Exception ex)