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

Add an example with SSR caching. #497

Merged
merged 4 commits into from
Dec 23, 2016
Merged

Conversation

arunoda
Copy link
Contributor

@arunoda arunoda commented Dec 23, 2016

This is pretty interesting :)

})
.catch((err) => {
console.error(err.stack)
res.status(500).send('Internal Error')
Copy link
Contributor

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

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is awesome

@rauchg rauchg merged commit b9bee24 into vercel:master Dec 23, 2016
@rauchg
Copy link
Member

rauchg commented Dec 23, 2016

Really impressive @arunoda

@sedubois
Copy link
Contributor

sedubois commented Feb 5, 2017

Doesn't this go against the idea of separating concerns? Shouldn't caching be done by an external service?

@arunoda
Copy link
Contributor Author

arunoda commented Feb 6, 2017

@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.

@arunoda arunoda deleted the ssr-caching-example branch February 6, 2017 02:54
@sedubois
Copy link
Contributor

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?

@sedubois
Copy link
Contributor

sedubois commented Feb 14, 2017

Also @arunoda what about the SSR pages asked by next-prefetcher (e.g /_next/-/pages/, etc)? At the moment those requests bypass the cache completely, although if there are any <Link prefetch ...> in the app, it will be the main load on the server.

@sedubois
Copy link
Contributor

Oh I keep forgetting, next-prefetcher doesn't do a pre-render, it just downloads the code.

@lock lock bot locked as resolved and limited conversation to collaborators Jan 18, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants