5 ms·
Why? What matters when deciding how long to cache immutable content?
by lgas 9y ago
Why? What matters when deciding how long to cache immutable content?
- cpburns2009 9y agoInstructing the browser to cache a resource for a whole year just seems wasteful to me. I know it's completely arbitrary but if your browser hasn't used something cached for over a month, you likely don't need it cached anymore. Now, I do realize browsers have their own rules for maintaining their caches and may not even cache something for a year. That just seems like a very long time. For example: Say many websites start adopting immutable, version all of their resources, and ~25% percent of their resources are updated monthly. I could easily see the browser cache growing to an excessive size over a year before things begin being purged from the cache. Excessively long cache times are sloppy. That's why I think it matters.
- eridius 9y agoJust because the server gives it a year timeout doesn't mean browsers must hold onto it for a year! The max-age is just a maximum age, not an exact age. Browsers can of course discard any cached responses that they don't think they're going to need again.
- bzbarsky 9y agoBrowser caches can hold on to things longer than the freshness lifetime, and do. They can also evict things before the freshness lifetime is up, and do. The freshness lifetime is one of the things a browser can use to decide how long to keep something in its cache, but not the only one.