From 2e5abe50eae112922b1669ce813fc16ad6ec393e Mon Sep 17 00:00:00 2001 From: Haiping Chen Date: Mon, 26 Aug 2024 22:47:26 -0500 Subject: [PATCH] =?UTF-8?q?=E5=A6=82=E6=9E=9C=E6=9C=89=E6=96=B0=E8=AE=B0?= =?UTF-8?q?=E5=BD=95=E5=B0=B1=E6=9A=82=E4=B8=8D=E7=BC=93=E5=AD=98=E6=9C=AC?= =?UTF-8?q?=E6=AC=A1=E6=90=9C=E7=B4=A2=E7=BB=93=E6=9E=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Infrastructures/SharpCacheAttribute.cs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/Infrastructure/BotSharp.Abstraction/Infrastructures/SharpCacheAttribute.cs b/src/Infrastructure/BotSharp.Abstraction/Infrastructures/SharpCacheAttribute.cs index 03bc70bb..17ddb830 100644 --- a/src/Infrastructure/BotSharp.Abstraction/Infrastructures/SharpCacheAttribute.cs +++ b/src/Infrastructure/BotSharp.Abstraction/Infrastructures/SharpCacheAttribute.cs @@ -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(); + if (httpContext.HttpContext.Response.Headers["Cache-Control"].ToString().Contains("no-store")) + { + return; + } + var cache = Services.GetRequiredService(); if (context.ReturnValue != null)