Add element-level opt-out for page caching#3980
Open
robinboening wants to merge 1 commit into
Open
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #3980 +/- ##
=======================================
Coverage 98.12% 98.12%
=======================================
Files 346 346
Lines 8971 8980 +9
=======================================
+ Hits 8803 8812 +9
Misses 168 168 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
834ae20 to
19a8a0b
Compare
Allow element definitions to declare page_cache: false so pages that contain or can render those elements skip HTTP page-shell caching. Use no-store for this opt-out because no-cache still permits stored responses and conditional revalidation, which can return 304 before element-level cache variants are rendered. Keep the option as definition-only metadata and cover the new behavior with model and request specs.
19a8a0b to
e5c19c5
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #3973.
This adds a
page_cacheoption to element definitions, allowing individual elements to opt a page out of HTTP page caching:When a page contains, or can render, an element definition with
page_cache: false, Alchemy now renders the page instead of relying on conditional page-cache revalidation. This lets dynamic or permission-sensitive elements execute and apply their own fragment cache keys.The opt-out uses
Cache-Control: no-storerather than no-cache, because no-cache may still allow stored responses to be revalidated and return 304, which would skip rendering the element entirely.The option defaults to true and is kept as definition-only metadata, so existing element definitions and page cache behavior remain unchanged unless an element explicitly opts out.
Checklist