Cache-control Immutable Header

做~自己de王妃 提交于 2020-08-11 03:14:49

问题


I was reading about immutable header and i came across with this article saying that:

Cache-Control: max-age=365000000, immutable

When a client supporting immutable sees this attribute it should assume that the resource, if unexpired, is unchanged on the server and therefore should not send a conditional revalidation for it (e.g. If-None-Match or If-Modified-Since) to check for updates. Correcting possible corruption (e.g. shift reload in Firefox) never uses conditional revalidation and still makes sense to do with immutable objects if you're concerned they are corrupted.

source

I cant understand this phrase "if unexpired, is unchanged on the server and therefore should not send a conditional revalidation"

Client, by default doesnt send a revalidation until the max-age is expired.

So whats the point define immutable in the first place?


回答1:


People pressing the refresh button.

Facebook, who first proposed this immutable cache-control directive, have a good post on this about how it saved them a huge amount of requests, including this quote:

The problem with reloads

The browser’s reload button exists to allow the user to get an updated version of the current page. In order to meet this goal, when you reload, browsers revalidate the page that you are currently on, even if that page hasn’t expired yet. However, they also go a step further and revalidate all sub-resources on the page — things like images and JavaScript files.



来源:https://stackoverflow.com/questions/61050144/cache-control-immutable-header

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!