Cache-control 不可变 Header
Cache-control Immutable Header
我正在阅读有关不可变 header 的文章,我看到这篇文章说:
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.
我听不懂这句话"if unexpired, is unchanged on the server and therefore should not send a conditional revalidation"
客户端,默认情况下不会发送重新验证,直到 max-age 过期。
那么首先定义不可变的意义何在?
有人按下了刷新按钮。
首先提出此不可变缓存控制指令的 Facebook good post on this 关于它如何为他们节省大量请求,包括以下引述:
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.
我正在阅读有关不可变 header 的文章,我看到这篇文章说:
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.
我听不懂这句话"if unexpired, is unchanged on the server and therefore should not send a conditional revalidation"
客户端,默认情况下不会发送重新验证,直到 max-age 过期。
那么首先定义不可变的意义何在?
有人按下了刷新按钮。
首先提出此不可变缓存控制指令的 Facebook good post on this 关于它如何为他们节省大量请求,包括以下引述:
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.