Commit 6bde20d7 by 陶然

增加缓存

parent b89945db
...@@ -32,6 +32,6 @@ using System.Runtime.InteropServices; ...@@ -32,6 +32,6 @@ using System.Runtime.InteropServices;
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值 //可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
//通过使用 "*",如下所示: //通过使用 "*",如下所示:
// [assembly: AssemblyVersion("1.0.*")] // [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("5.4.2024.9180")] [assembly: AssemblyVersion("5.4.2024.9240")]
[assembly: AssemblyFileVersion("5.4.2024.9180")] [assembly: AssemblyFileVersion("5.4.2024.9240")]
...@@ -104,9 +104,10 @@ namespace Jst.Lims.Timeliness ...@@ -104,9 +104,10 @@ namespace Jst.Lims.Timeliness
EndDate = DateTime.Parse(EndDate.ToString("yyyy-MM-dd")); EndDate = DateTime.Parse(EndDate.ToString("yyyy-MM-dd"));
if (EndDate < BeginDate) throw new Exception("查询结束日期不可小于开始日期!"); if (EndDate < BeginDate) throw new Exception("查询结束日期不可小于开始日期!");
(EndDate.Subtract(BeginDate).Days > 31).ThrowIfTrue("时间跨度不得大于31天!"); (EndDate.Subtract(BeginDate).Days > 31).ThrowIfTrue("时间跨度不得大于31天!");
var kvids = PolicyNodeKvids.OrderBy(o => o).Join(",");
#region 启用缓存,20分钟内查询条件相同不重复请求数据库 #region 启用缓存,20分钟内查询条件相同不重复请求数据库
var cache = KiviiContext.GetCacheClient(); var cache = KiviiContext.GetCacheClient();
var cacheKey = KiviiContext.GetUrnKey($"{this.GetType().FullName}_Request_{BeginDate:G}_{EndDate:G}_{TimeFilter}_{Grouped}_{Urgent}_{PolicyNodeKvids.Join(",")}"); var cacheKey = KiviiContext.GetUrnKey($"{this.GetType().FullName}_Request_{BeginDate:G}_{EndDate:G}_{TimeFilter}_{Grouped}_{Urgent}_{kvids}");
var cacheValue = cache.Get<RestfulQueryResponse<TimelineStatistic>>(cacheKey); var cacheValue = cache.Get<RestfulQueryResponse<TimelineStatistic>>(cacheKey);
if (cacheValue != null) if (cacheValue != null)
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment