Skip to content

Sync output cache with API review #43121

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 13 commits into from
Aug 15, 2022
Merged

Sync output cache with API review #43121

merged 13 commits into from
Aug 15, 2022

Conversation

sebastienros
Copy link
Member

Applying API review feedback, and adding anticipated changes from new one

builder.Append(KeyDelimiter)
.Append(routeValueName)
.Append('=')
.Append(Convert.ToString(routeValueValue, CultureInfo.InvariantCulture));
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A route value is an object as opposed to headers and queries. I think we need to force the culture here for normalize the key.

@@ -46,15 +46,13 @@ ValueTask IOutputCachePolicy.ServeResponseAsync(OutputCacheContext context, Canc
// Verify existence of cookie headers
if (!StringValues.IsNullOrEmpty(response.Headers.SetCookie))
{
context.Logger.ResponseWithSetCookieNotCacheable();
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed logs from this policy as it requires the logger to be resolved (on each request?) and also because further policies can negate the results here and the lot would be wrong.

var varyByPrefix = context.CacheVaryByRules.VaryByPrefix;

// Check if any vary rules exist
if (!StringValues.IsNullOrEmpty(varyHeaders) || !StringValues.IsNullOrEmpty(varyQueryKeys) || !StringValues.IsNullOrEmpty(varyByPrefix) || varyByCustomKeys?.Count > 0)
if (!StringValues.IsNullOrEmpty(varyHeaderNames) || !StringValues.IsNullOrEmpty(varyRouteValueNames) || !StringValues.IsNullOrEmpty(varyQueryKeys) || !StringValues.IsNullOrEmpty(varyByPrefix) || varyByCustomKeys?.Count > 0)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line is pretty long, may be better to wrap it

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have another PR that will remove it, so I will ignore it for now (if I may).

Copy link
Member

@wtgodbe wtgodbe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@sebastienros sebastienros merged commit ff444e5 into main Aug 15, 2022
@sebastienros sebastienros deleted the sebros/cacheupdate branch August 15, 2022 19:03
@ghost ghost added this to the 7.0-rc1 milestone Aug 15, 2022
@amcasey amcasey added the area-middleware Includes: URL rewrite, redirect, response cache/compression, session, and other general middlewares label Jun 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-middleware Includes: URL rewrite, redirect, response cache/compression, session, and other general middlewares
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants