缓存控制不可变标头 [英] Cache-control Immutable Header

查看:75
本文介绍了缓存控制不可变标头的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在阅读有关不可变标头的信息,并且偶然发现这篇文章说:

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


缓存控制:max-age = 365000000 ,不可变

Cache-Control: max-age=365000000, immutable

当支持不可变的客户端看到此属性时,应
假定资源(如果未过期)在服务器上不变,因此
不应发送有条件的重新验证(例如
If-None-Match或If-Modified-Since)来检查更新。纠正
可能的损坏(例如Firefox中的移位重新加载)永远不会使用
有条件的重新验证,如果您担心不可变的
对象已损坏,则仍然有意义。

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?

推荐答案

人们按下刷新按钮。

Facebook,谁首先提出了这个不变的缓存控制指令,其关于此内容的好帖子它为他们节省了大量请求,包括以下报价:

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:


重新加载的问题

存在浏览器的重新加载按钮,允许用户获取当前页面的更新的
版本。为了实现此目标,当您重新加载$ ​​b $ b时,浏览器会重新验证您当前所在的页面,即使该页面尚未过期也可以重新验证
。但是,它们还会更进一步
并重新验证页面上的所有子资源,例如图像和
JavaScript文件。

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.

这篇关于缓存控制不可变标头的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆