How long does Google Chrome cache a resource if expires and/or no-cache headers are not set? How long does Google Chrome cache a resource if expires and/or no-cache headers are not set? google-chrome google-chrome

How long does Google Chrome cache a resource if expires and/or no-cache headers are not set?


The time the browser considers a cached response fresh is usually relative to when it was last modified:

Since origin servers do not always provide explicit expiration times, a cache MAY assign a heuristic expiration time when an explicit time is not specified, employing algorithms that use other header field values (such as the Last-Modified time)... If the response has a Last-Modified header field (Section 2.2 of [RFC7232]), caches are encouraged to use a heuristic expiration value that is no more than some fraction of the interval since that time. A typical setting of this fraction might be 10%. [https://tools.ietf.org/html/rfc7234#section-4.2.2]

The details of how Chrome (and other browsers) calculate that value, can be found in the source code (An example from Chrome v49). It would appear that Chrome also calculates the value relative to the Last-Modified header.

(Credit to this post)


DEFAULT_CACHE_TIME = 300

I found the above by searching at http://code.google.com/p/chromium/source/search?q=DEFAULT_CACHE_TIME&origq=DEFAULT_CACHE_TIME&btnG=Search+Trunk for "DEFAULT_CACHE_TIME".

There's a file called "chromeextensionsdocs.py" that contains the DEFAULT_CACHE_TIME.

I believe this is seconds based on the example given at http://code.google.com/appengine/docs/python/memcache/overview.html
In "chromeextensionsdocs.py", the DEFAULT_CACHE_TIME is sent as the last param in memcache.add

I'm not totally sure if this is the right value or not but seems likely that it is when putting the pieces together.