Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the difference between no-cache and no-store in Cache-control?

I don't find get the practical difference between Cache-Control:no-store and Cache-Control:no-cache.

As far as I know, no-store means that no cache device is allowed to cache that response. In the other hand, no-cache means that no cache device is allowed to serve a cached response without validate it first with the source. But what is that validation about? Conditional get?

What if a response has no-cache, but it has no Last-Modified or ETag?

Regards.

like image 694
vtortola Avatar asked Sep 27 '11 17:09

vtortola


People also ask

What is difference between no cache and no-store?

As far as I know, no-store means that no cache device is allowed to cache that response. In the other hand, no-cache means that no cache device is allowed to serve a cached response without validate it first with the source.

What is Cache Control No-store?

Cache-Control: No-Store The no-store directive means browsers aren't allowed to cache a response and must pull it from the server each time it's requested. This setting is usually used for sensitive data, such as personal banking details.

Should I use cache control no cache?

Cache-control is an important way by which developers can dictate how resources will be cached when a user browses the internet. Without cache-control, the browser caching and the resulting experience for the user will be sub-optimal.

What if there is no cache?

If there is no cache available, the browser can't load data from the cache, which is the same as disabling cache. Using the extension isn't any complicating either.


2 Answers

See the below flow chart for better understanding enter image description here

Ref: (https://developers.google.com/web/fundamentals/performance/optimizing-content-efficiency/http-caching?hl=en#cache-control)

like image 127
Pruthviraj Avatar answered Oct 02 '22 15:10

Pruthviraj


But what is that check about?

Exactly checking Last-Modified or ETag. Client would ask server if it has new version of data using those headers and if the answer is no it will serve cached data.


Update

From RFC

no-cache     If the no-cache directive does not specify a field-name, then 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.  
like image 35
Alex Gitelman Avatar answered Oct 02 '22 17:10

Alex Gitelman