Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
ysmoradi committed Jan 27, 2025
1 parent 5a303e2 commit adec59b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ public async ValueTask CacheRequestAsync(OutputCacheContext context, Cancellatio

if (context.HttpContext.User.IsAuthenticated() && responseCacheAtt.UserAgnostic is false)
{
// See UserAgnostic comments.
edgeCacheTtl = -1;
outputCacheTtl = -1;
}
Expand All @@ -46,6 +47,7 @@ public async ValueTask CacheRequestAsync(OutputCacheContext context, Cancellatio
}
//#endif

// Edge - Browser Cache
if (browserCacheTtl != -1 || edgeCacheTtl != -1)
{
context.HttpContext.Response.GetTypedHeaders().CacheControl = new()
Expand All @@ -57,6 +59,7 @@ public async ValueTask CacheRequestAsync(OutputCacheContext context, Cancellatio
context.HttpContext.Response.Headers.Remove("Pragma");
}

// ASP.NET Core Output Cache
if (env.IsDevelopment() is false // To enhance the developer experience, return from here to make it easier for developers to debug cacheable pages.
&& outputCacheTtl != -1)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ public async ValueTask CacheRequestAsync(OutputCacheContext context, Cancellatio

if (context.HttpContext.User.IsAuthenticated() && responseCacheAtt.UserAgnostic is false)
{
// See UserAgnostic comments.
edgeCacheTtl = -1;
outputCacheTtl = -1;
}
Expand All @@ -44,6 +45,7 @@ public async ValueTask CacheRequestAsync(OutputCacheContext context, Cancellatio
browserCacheTtl = -1;
}

// Edge - Browser Cache
if (browserCacheTtl != -1 || edgeCacheTtl != -1)
{
context.HttpContext.Response.GetTypedHeaders().CacheControl = new()
Expand All @@ -55,6 +57,7 @@ public async ValueTask CacheRequestAsync(OutputCacheContext context, Cancellatio
context.HttpContext.Response.Headers.Remove("Pragma");
}

// ASP.NET Core Output Cache
if (env.IsDevelopment() is false // To enhance the developer experience, return from here to make it easier for developers to debug cacheable pages.
&& outputCacheTtl != -1)
{
Expand Down

0 comments on commit adec59b

Please sign in to comment.