如果有新记录就暂不缓存本次搜索结果

This commit is contained in:
Haiping Chen 2024-08-26 22:47:26 -05:00
parent 64a1f686c3
commit 2e5abe50ea

View file

@ -1,4 +1,5 @@
using BotSharp.Abstraction.Infrastructures;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.DependencyInjection;
using Rougamo;
using Rougamo.Context;
@ -42,6 +43,12 @@ public class SharpCacheAttribute : MoAttribute
return;
}
var httpContext = Services.GetRequiredService<IHttpContextAccessor>();
if (httpContext.HttpContext.Response.Headers["Cache-Control"].ToString().Contains("no-store"))
{
return;
}
var cache = Services.GetRequiredService<ICacheService>();
if (context.ReturnValue != null)