Cache-Control for Civilians

This article is a repost promoting content originally published elsewhere. See more things Dan's reposted.

Cache-Control for Civilians – CSS Wizardry – CSS Architecture, Web Performance Optimisation, and more, by Harry Roberts (csswizardry.com)

One of the most common and effective ways to manage the caching of your assets is via the Cache-Control HTTP 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.

A Cache-Control header might look something like this:

Cache-Control: public, max-age=31536000

Cache-Control is the header, and each of public and max-age=31536000 are directives. The Cache-Control header 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.

0 comments

    Reply here

    Your email address will not be published. Required fields are marked *

    Reply on your own site

    Reply by email

    I'd love to hear what you think. Send an email to b13090@danq.me; be sure to let me know if you're happy for your comment to appear on the Web!