Skip to content
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

clearing cache not having effect as max-age directive is making browser not connectin to the server to check the if cache is valid #423

Open
IOR88 opened this issue May 5, 2024 · 1 comment
Assignees
Labels
needs-triage Needs to be reviewed question Further information is requested

Comments

@IOR88
Copy link

IOR88 commented May 5, 2024

I think the end part of the code is making the browser to not refresh the cache, I saw discussions about it in the forum but not sure how we could change it, as I think this logic maybe different on per view basis ? I have one api for which I need to clear cache when other apis are triggered to refresh information, in that case I cannot pass max-age, I should pass no-cache, as other way browser is not verifying if cache is valid.

            # response.headers["Cache-Control"] = f"max-age={expire}"
            etag = f"W/{hash(encoded_ret)}"
            response.headers["ETag"] = etag
            return ret
@vicchi
Copy link
Collaborator

vicchi commented Nov 9, 2024

@IOR88 If I'm reading you correctly this is as intended. The browser is honouring the max-age and even if the cached entry has been invalidated on the API, the browser will wait until max-age has expired before going back to the API.

@vicchi vicchi self-assigned this Nov 9, 2024
@vicchi vicchi added question Further information is requested needs-triage Needs to be reviewed labels Nov 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-triage Needs to be reviewed question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants