One of the most common and effective ways to manage the caching of your assets is via the
Cache-ControlHTTP header. This header applies to individual assets, meaning everything on our pages can have a very bespoke and granular cache policy. The amount of control we’re granted makes for very intricate and powerful caching strategies.
Cache-Controlheader might look something like this:
Cache-Control: public, max-age=31536000
Cache-Controlis the header, and each of
max-age=31536000are directives. The
Cache-Controlheader can accept one or more directives, and it is these directives, what they really mean, and their optimum use-cases that I want to cover in this post.
A great reference for configuring your HTTP caching headers.