What does the use of browser caching mean

HTTP Caching FAQ

What is cached?

The Mozilla cache contains all documents that have been downloaded by the user via HTTP. This may sound contradictory at first, but this behavior enables you to navigate back and forth, save and display the source text etc. in the browser without the need for additional server requests. It also improves the offline use of temporarily stored content in the cache.

What about documents that are sent with "Cache-control: no-cache" in the header?

We also store "no-cache" documents in the cache for the reasons mentioned above.

Doesn't that ensure that expired content is served?

No, because every document that is stored in the Mozilla cache is given a period of validity. If Mozilla loads this document for normal viewing, the validity will be taken into account. If necessary, a document to be loaded from the cache is compared with the server and, if necessary, reloaded before it is displayed to the user.

How is the validity period calculated (since not every server response has a validity in the header)?

Mozilla strives to implement RFC 2616 (see Section 13 specifically for more information). Each of the following response headers generates an expired period of validity, e.g. "00:00:00 UTC, January 1, 1970":

Cache-control: no-cache Cache-control: no-store Pragma: no-cache Expires: 0

Notably, the values ​​and are technically invalid values ​​in a response header. If none of this information is available, the calculation of the period of validity is carried out according to the algorithm which is specified in RFC 2616, Section 13.2. is described. We determine the current age of the answer and its validity based on the information available.

The current age is usually close to zero, but is influenced by an existing e-entry in the response header, which is used by proxy caches, for example, to indicate the length of time that a document has been in their cache. The exact algorithm that tries to prevent errors in the time shift is described in RFC 2616, section 13.2.3.

Validity is calculated based on multiple response headers. If the header is specified, the validity of the document corresponds to the value N. If this value is not available, which is sometimes the case, a search is made for an entry in the header. If this exists, the period of validity results from the value contained therein minus the value contained in. If there is ultimately no information in the response headers, a value is searched for. If this value is available, the period of validity in the cache corresponds to the value minus the value divided by 10. This is the simplified representation of the heuristic algorithm proposed in Section 13.2.4 of RFC 2616.

The period of validity is calculated as follows:

expiry time = reaction time + novelty lifetime - current age

Where corresponds to the time value at which the browser received the response.

Are there other factors that influence the revalidation?

The revalidation is triggered as soon as a user reloads the page (e.g. using the reload button). It is also triggered during normal browsing if it is included in the response headers. Another factor is the cache management settings in the Firefox settings area. An option can be selected here that documents are re-validated each time they are loaded ("Ask me if websites want to save data for use in offline mode").

How does cache valuation work?

As soon as the validity of a document in the cache has expired, it is either revalidated or completely re-requested from the server. Validation can only be used if the server has either a strong valdiation (strong validation) or a weak valdiation (weak validation). Cache validators are described in section 13.3.2 of RFC 2616.

The value in the response headers is a value that cannot be viewed by the user agent (opaque-to-the-useragent) and can be used as a strong validator. If the value is present in the response headers, the browser can output a value in the request headers to validate the document in the cache.

The value in the response headers can be used as a weak validator. It is rated as weak because it only allows a 1 second solution. If the value is included in the response headers, the browser can print a value in the request headers to validate the document in the cache.

As soon as a validation request has been made, the server can either ignore it and respond with a normal status code, or return a status code to instruct the browser to use the cached copy of the document. The latter can also contain values ​​in the response header which update the validity of the document in the cache.

Information on the original document

What about...?

I intend to expand this documentation in the future. Feel free to email me with your questions or comments.

  • Author (s): Darin Fisher
  • Last updated: June 16, 2004
  • Copyright information: Parts of the content are copyright © 1998–2007 individual contributors to mozilla.org; Content licensed under a Creative Commons license | Details.