Http 1.1 的缓存机制
Expires: Wed, 21 Oct 2015 07:28:00 GMT
Pragma:no-cache (http/1.0)
与 Cache-Control: no-cache 效果一致。
Cache-Control: max-age=<seconds>
Cache-Control: max-stale[=<seconds>] stale时,容许接收proxy缓存的最大过期时间
Cache-Control: min-fresh=<seconds>
Cache-control: no-cache
Cache-control: no-store
Cache-control: no-transform
Cache-control: only-if-cached
服务器可以在响应中使用的标准 Cache-Control 指令。
Cache-control: no-cache 每次加载资源需要条件请求是否过期
Cache-control: no-store 完全不缓存,每次都去服务器拉取
Cache-control: no-transform
Cache-control: public
Cache-control: private
Cache-control: must-revalidate stale的资源必须revalidate
Cache-control: proxy-revalidate proxy的stale资源必须revalidate
Cache-Control: max-age=<seconds>
Cache-control: s-maxage=<seconds> proxy的max-age
Age: 160859
If there is a Cache-Control header with the “max-age” or “s-maxage” directive in the response, the Expires header is ignored. –MDN
As a rule of thumb, if it’s something everybody can access (for example, the logo in this page) cache-control: public might be better, because the more people that cache it, the less bandwidth you’ll need. If it’s something that is related to the connected user (for example, the HTML in this page includes my username, so it won’t be useful to anyone else) cache-control: private will be better, as the proxies would be caching data that won’t be requested by other users, and they might also be keeping data that you don’t want to be kept in servers that you don’t trust. –Stack Overflow
Use Pragma only for backwards compatibility with HTTP/1.0 clients.