-
-
Notifications
You must be signed in to change notification settings - Fork 170
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
Preview tokens 6: Version-based page caching #6827
base: v5/develop
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks all right to me - maybe @bastianallgeier also has a look
Updating a changes version does not flush the pages cache (would be pretty wasteful), so rendered changes versions should also never be cached. Extra logic is needed because one can now manually pass the changes version to render, even if no request param is set (which would also prevent caching with existing logic).
1d732df
to
e79cc36
Compare
Just rebased against |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks good to me too. Just one question: could we omit the additional version part in the cache id for the latest version? Then the old cache entries could still stay valid. It's just a thought though. I don't mind the breaking ids too much.
Hm, good question. In Staticache we currently parse the cache ID by splitting it with I wonder if this could cause ambiguity, e.g. if a UID contains a dot for whatever reason. Then Staticache could not detect what is the UID and what the version ID. Not sure if we need to support that (I think the Panel doesn't allow pages with dot in the UID), but in the filesystem it could exist and cause a complexity nightmare. |
Description
Summary of changes
This PR makes the pages cache behave well with the new
$versionId
param for$page->render()
, even when e.g. generating a static site manually.Reasoning
Updating a changes version does not flush the pages cache (would be pretty wasteful), so rendered changes versions should also never be cached.
Extra logic is needed because one can now manually pass the changes version to render, even if no request param is set (which would also prevent caching with existing logic).
Cache ID is already changed because v5 is a good opportunity to do so. This prepares the code for future additions to our version types (e.g. revision support).
Additional context
The breaking change also affects our Staticache plugin. We need to release a version for v5 that supports the version addition to the cache ID.
Changelog
Enhancements (since alphas)
latest
version, not thechanges
version. This is because updating thechanges
version does not flush the pages cache. Sochanges
previews are always rendered live.Breaking changes
.latest
, e.g.home.latest.html
.Docs
None
Ready?
For review team
Add lab and/or sandbox examples (wherever helpful)