When sent by the origin server
I believe max-age=0
simply tells caches (and user agents) the response is stale from the get-go and so theySHOULD revalidate the response (eg. with the If-Not-Modified
header) before using a cached copy, whereas, no-cache
tells them they MUST revalidate before using a cached copy. From 14.9.1 What is Cacheable:
no-cache
...a cache MUST NOT use the response to satisfy a subsequent request without successful revalidation with the origin server. This allows an origin server to prevent caching even by caches that have been configured to return stale responses to client requests.
In other words, caches may sometimes choose to use a stale response (although I believe they have to then add a Warning
header), but no-cache
says they're not allowed to use a stale response no matter what. Maybe you'd want the SHOULD-revalidate behavior when baseball stats are generated in a page, but you'd want the MUST-revalidate behavior when you've generated the response to an e-commerce purchase.
Although you're correct in your comment when you say no-cache
is not supposed to prevent storage, it might actually be another difference when using no-cache
. I came across a page, Cache Control Directives Demystified, that says (I can't vouch for its correctness):
In practice, IE and Firefox have started treating the no-cache directive as if it instructs the browser not to even cache the page. We started observing this behavior about a year ago. We suspect that this change was prompted by the widespread (and incorrect) use of this directive to prevent caching.
...
Notice that of late, "cache-control: no-cache" has also started behaving like the "no-store" directive.
As an aside, it appears to me that Cache-Control: max-age=0, must-revalidate
should basically mean the same thing as Cache-Control: no-cache
. So maybe that's a way to get the MUST-revalidate behavior ofno-cache
, while avoiding the apparent migration of no-cache
to doing the same thing as no-store
(ie. no caching whatsoever)?
When sent by the user agent
I believe shahkalpesh's answer applies to the user agent side. You can also look at 13.2.6 Disambiguating Multiple Responses.
If a user agent sends a request with Cache-Control: max-age=0
(aka. "end-to-end revalidation"), then each cache along the way will revalidate its cache entry (eg. with the If-Not-Modified
header) all the way to the origin server. If the reply is then 304 (Not Modified), the cached entity can be used.
On the other hand, sending a request with Cache-Control: no-cache
(aka. "end-to-end reload") doesn't revalidate and the server MUST NOT use a cached copy when responding.
相关推荐
- 示例:`var name = prompt("What is your name?", "John Doe");` 18. **位置控制** - 设置或获取当前页面的URL:`window.location.href` - 示例:`window.location.href = "https://www.example.com";` 19. ...
- Q: What do you think of the chicken soup here? - A: I think it is very good. 18. 问路: - Q: Excuse me, could you tell me the way to Shanghai Museum? - A: Go straight ahead and turn left. 19. ...
= what's up? (你好吗?) - nm = not much (还行) - cl = cool - luv u = love you - cu = see you (再见) - urg = 哎呦 (表示无奈或烦) - &= and 6. **同意与不同意的地道表达**: - Go ahead:可以 - It'...
cache-time: how long to force UA to no cache(in ms), default: 600*1000(10 mins) flag-name: what is the name of random query param, do not conflict the regex, default: flag --> < script src...
- What’s that over there?:那边那个是什么? - Where’s my storybook?:我的故事书在哪里? - 它在椅子上面。:It’s on the chair. - Where’s his key?:他的钥匙在哪里? - Is this his fan?:这是他的...
= what's up? (你好吗?) - nm = not much (还行) - cl = cool - luvu = love you - cu = see you (再见) - urg = 哎呦 (表示无奈或烦) - &= and 6. **同意、不同意的地道用法**: - Go ahead:可以 - It's...
- What’s this/ that (in English)?:这是什么? - How do you spell it?:你怎么拼写它? 通过深入理解和掌握这些短语与句型,学生可以更好地应对日常生活和课堂交流中的各种场景,同时为后续的英语学习打下...
- 拓展词汇:plant trees, plant flowers, eat ice cream, play in the snow, summer vacation, winter vacation 2. **词汇拓展**: - 描述颜色和活动的词汇:paint a picture, golden, green, white, pink 3. *...
- come and play table tennis:来打乒乓球 - what a pity:真遗憾 - at school:在学校 - after school:放学后 4. 发音: - Aa / ? /:如bag(书包),cap(帽),hamburger(汉堡包),sandwich(三明治)...
:What’s your favorite program? - 你多久做一次运动?:How often do you exercise? - 我几乎没有踢过足球:I hardly ever play soccer. - 大多数学生每星期看电视两次:Most students watch TV twice a week....
Imagine how quickly you could work if you knew the best practices and the best tools? Stop wasting your time searching and have everything you need to be productive in one, well-organized place, ...
【知识点详解】 1. **名词类** - 报纸:newspaper - 汤:soup - 电影:film - 房子:house ...:What's the weather like in Beijing? = How is the weather in Beijing? - 近况如何?:How have you been?
- 句型:(1)What's the capital of China? It's Beijing. - 句型:(2)What colour is the flag of ⋯? 6. **对其他国家的认知**: - 单词:know about, star - 句型:(1)What do you know about Canada? - ...
What did you do at the weekend? We visited lots of places. - 4. Where did you go? 以上是针对五年级英语上学期期末复习材料中的主要知识点进行的详细解析,涵盖了词汇、短语、专有名词和句子翻译等方面,...
- 例句:What time is the meeting? - 对日期、月份或年份提问:when - 例句:When is your birthday? - 询问做某事的时间:what time / when - 例句:What time do you usually wake up? - **时间表达方式**:...
- What’s in the school? 通过这些句子结构的学习,学生可以更好地描述房间内的物品及其位置。 - **It is a birthday gift from my father.** 中的 **from** 用法。 - **from** 表示“来自”或“由…赠送”。 ...
- what's = what is:是什么 - name's = name is:名字是 - aren't = are not:不是 - that's = that is:那是 - they're = they are:他们是 - who's = who is:是谁 - who're = who are:他们是谁 4. 对话...
7. - What’s the shape of your present? - It’s round.:- 你的礼物的形状是什么?- 它是圆形的。 8. - What shape is it? - It’s a rectangle.:- 它是什么形状?- 它是长方形的。 9. - What do we use it for?...
答句:It’s on the first/second floor. 在一/二楼。 2. This is the teacher’s office. 这是教师办公室。This is+… 这个是… 3. That is my classroom. 那个是我们的教室。That is… 那个是… 4. How many ...
= What's the weather like in Zhuzhou? - 天气如何? = How is the weather? 2. 描述天气的词汇: - 下雨 = rainy - 晴朗的 = sunny - 多云的 = cloudy - 刮风的 = windy - 下雪的 = snowy 3. 描述天气的...