-
Notifications
You must be signed in to change notification settings - Fork 325
cache-control and stale-while-revalidate fixes
#1216
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
Conversation
This comment has been minimized.
This comment has been minimized.
|
@wizardlyhel Do we need to make any updates to https://github.com/Shopify/hydrogen/blob/v1.x-2022-07/docs/framework/cache.md#full-page-caching? |
|
@mcvinci No change to doc - this will work magically on its own with the existing caching options. I might need to add new helper functions later. I'll let you know if there are any doc updates. |
cache-control and stale-while-revalidate fixes
|
Full page caching feature moved to Shopify/hydrogen#1294 |
jplhomer
left a comment
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.
A few comments and questions. Nice work catching all the bugs!
|
|
||
| const streamer = rscWriter.renderToPipeableStream(AppRSC); | ||
| response.writeHead(200, 'ok', { | ||
| 'cache-control': componentResponse.cacheControlHeader, |
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 like we're not writing any value for cache-control 🤔 where does the cache header (default and specific) get written?
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 is being set inside ServerComponentResponse.cache
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.
actually nvm - I was wrong
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.
Took this fix (that didn't fix) out of this PR
| CacheSeconds({ | ||
| maxAge: 10, | ||
| }) |
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.
Why are we setting a maxAge + SWR for the cache lock?
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.
Because the key needs to be valid (so that it stays in cache), so that future cache.get attempts on revalidating the same key (while a revalidation of the same key is in progress) will get a HIT response
jplhomer
left a comment
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.
Thanks!
Co-authored-by: Josh Larson <[email protected]>
Description
Get cache to store full page response
This PR contains a couple fixes:
Before submitting the PR, please make sure you do the following:
fixes #123)yarn changeset addif this PR cause a version bump based on Keep a Changelog and adheres to Semantic Versioning