读书人

What#039;s the difference between Cache

发布时间: 2013-12-15 22:17:18 作者: rapoo

What's the difference between Cache-Control: max-age=0 and no-cache?

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.

读书人网 >Web前端

热点推荐