Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/dotnet/aspnetcore.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'src/Middleware/OutputCaching/src/OutputCacheAttribute.cs')
-rw-r--r--src/Middleware/OutputCaching/src/OutputCacheAttribute.cs8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/Middleware/OutputCaching/src/OutputCacheAttribute.cs b/src/Middleware/OutputCaching/src/OutputCacheAttribute.cs
index 1409f20f5b..7194b63948 100644
--- a/src/Middleware/OutputCaching/src/OutputCacheAttribute.cs
+++ b/src/Middleware/OutputCaching/src/OutputCacheAttribute.cs
@@ -66,12 +66,18 @@ public sealed class OutputCacheAttribute : Attribute
return _builtPolicy;
}
- var builder = new OutputCachePolicyBuilder();
+ OutputCachePolicyBuilder builder;
if (PolicyName != null)
{
+ // Don't add the default policy if a named one is used as it could already contain it
+ builder = new OutputCachePolicyBuilder(excludeDefaultPolicy: true);
builder.AddPolicy(new NamedPolicy(PolicyName));
}
+ else
+ {
+ builder = new();
+ }
if (_noCache != null && _noCache.Value)
{