Exploring in-memory caching
Caching effectiveness increases the closer the cache is to the users. In-browser caching avoids network requests altogether. CDN-based caching can significantly shorten network requests. However, we may also give up more control over the cache the further it is away from our Remix server.
In this section, we will discuss in-memory caching strategies and learn about the advantages and disadvantages of in-memory caching options.
HTTP caching might not always be the right strategy. For instance, we already discussed privacy issues when caching user-specified information. In some cases, it might make sense to implement a custom caching layer on the web server.
The easiest way is to store computation results or fetched responses in memory on the server itself. However, as we learned in Chapter 3, Deployment Targets, Adapters, and Stacks, this may not always be possible. Runtime environments such as the edge and serverless may shut down after every request...