-
Notifications
You must be signed in to change notification settings - Fork 27.9k
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
Add an example with SSR caching. #497
Conversation
}) | ||
.catch((err) => { | ||
console.error(err.stack) | ||
res.status(500).send('Internal Error') |
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.
I think we can use app.renderError
or app.renderErrorToHTML
here
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.
Done!
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.
This is awesome
Really impressive @arunoda |
Doesn't this go against the idea of separating concerns? Shouldn't caching be done by an external service? |
@sedubois You could use a separate service like squid proxy. But this is for caching HTML (SSR), usually you need to bake some custom logic into when to invalidate the cache and so on. Doing that is kind a hard. Due to that reason, most of the caching servers/services do not cache HTML by default. |
Could you please explain what was the reasoning behind choosing an LRU cache vs e.g LFU or other cache eviction strategy? Do you have other good cache NPM packages to recommend? |
Also @arunoda what about the SSR pages asked by next-prefetcher (e.g |
Oh I keep forgetting, next-prefetcher doesn't do a pre-render, it just downloads the code. |
This is pretty interesting :)