Summary
In this chapter, you learned about different caching strategies and how to implement them with Remix.
Remix’s headers
route module API export lets us specify HTTP headers for the HTML document on a per-route level. We also have access to loaderHeaders
and parentHeaders
, which allows us to merge HTTP headers and specify headers based on the loader data.
You also learned how to cache both document and data requests in Remix. You learned how to use the Cache-Control
header to specify and prevent caching.
Then, you applied the private
, public
, max-age
, no-cache
, and immutable
directives. Additionally, you reviewed how Remix implements HTTP caching for static assets out of the box.
Next, you learned about the privacy concerns of caching user-specific data and how to use ETags to avoid downloading full responses while sending requests to the server where the user authorization can be checked.
Finally, we discussed in-memory caching and using services such as...