缓存控制的默认值是多少? [英] What's default value of cache-control?

查看:37
本文介绍了缓存控制的默认值是多少?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的问题是:有时浏览器会过度缓存一些资源,即使我已经修改过它们.但是F5之后,一切都很好.

My problem is: sometimes browser over-cached some resources even if i've already modified them. But After F5, everything is fine.

我整个下午都在研究这个案例.现在我完全理解了Last-Modified"或Cache-Control"的意义.而且我知道如何解决我的问题(只是 .js?version 或显式 max-age=xxxx).但是问题仍未解决:浏览器如何处理响应头没有Cache-Control"像这样:

I studied this case whole afternoon. Now i completely understood the point of "Last-Modified" or "Cache-Control". And i know how to solve my issue (just .js?version or explicit max-age=xxxx). But the problem is still unsolved: how does browser handle the response header without "Cache-Control" like this:

Content-Length: 49675
Content-Type: text/html
Last-Modified: Thu, 27 Dec 2012 03:03:50 GMT
Accept-Ranges: bytes
Etag: "0af7fcbdee3cd1:972"
Server: Microsoft-IIS/6.0
X-Powered-By: ASP.NET
Date: Thu, 24 Jan 2013 07:46:16 GMT 

他们在进入酒吧"时清楚地缓存它们

They clearly cache them when "Enter in the bar"

推荐答案

RFC7234 详细说明浏览器和代理默认应该做什么:

RFC 7234 details what browsers and proxies should do by default:

虽然缓存是 HTTP 的一个完全可选的特性,但它可以是假设重用缓存的响应是可取的,并且这样的当没有要求或本地时,重用是默认行为配置阻止它.因此,HTTP缓存要求是专注于防止缓存存储不可重用的响应或不恰当地重用存储的响应,而不是要求缓存始终存储和重用特定的响应.

Although caching is an entirely OPTIONAL feature of HTTP, it can be assumed that reusing a cached response is desirable and that such reuse is the default behavior when no requirement or local configuration prevents it. Therefore, HTTP cache requirements are focused on preventing a cache from either storing a non-reusable response or reusing a stored response inappropriately, rather than mandating that caches always store and reuse particular responses.

这篇关于缓存控制的默认值是多少?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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