
The cacheability of a resource is set using the directives below: Browser cache is referred to as a private cache, while a CDN cache is referred to as a shared cache. In addition to caching in your browser, if your content is behind a CDN then your cache-control headers influence how the CDN caches your content on the edge. Note: The Expires header is no longer needed as its behavior is covered by the Cache-Control header. In websites, this is dictated by the Cache-Control header which is defined in the HTTP/1.1 specification. This could be done to avoid having to recalculate an expensive computation or to place the content closer to the user. My goal is to provide you with a reference which you could use to answer the question, “How should I cache this resource?” What is caching?Ī cache is a store where you could put a resource. Disclaimer: The scope of this article isn’t to serve as a comprehensive guide to all possible caching strategies and how they work - there’s already plenty of content like that around. “There are only two hard things in Computer Science: cache invalidation and naming things.” ( Phil Karlton)Ģ5 years later, this well-known saying still holds true and while I cannot help you with the naming, I want to share what I know about caching to make it easier for you to decide on a caching strategy. Getting your caching strategy right can make a huge difference to your users - both repeat and first time. What’s quicker than a fast request? No request.

Caching plays a fundamental role in performance.
