HTTP caching

from Wikipedia, the free encyclopedia

HTTP caching is a technique in the Hypertext Transfer Protocol (HTTP) to temporarily store resources (documents, images, files in general) in a cache based on certain criteria in order to avoid unnecessary data transfers, server inquiries and to reduce access times. Since it must be ensured at the same time that the transmitted content is not out of date, it is necessary to be able to precisely control the intermediate storage of Internet pages or other resources . A number of tags are defined for this in the HTTP standard, which support caching on proxy and client level ( browser cache ).

Cache control methods

Three basic mechanisms are defined for HTTP to control caches: 'freshness', 'validity' and ' invalidation ' (eng: freshness , validation , invalidation ).

Freshness
Allows a response that has already been received to be reused without having to ask the source server again and can be controlled by both the server and the client. For example, there Expires - header a date at which the transmitted document stale ( "stale, stale") is, and the indication Cache-Control: max-age tells the cache how many seconds the answer is long fresh.
Validation
can be used to check whether a cached response is still up-to-date after it has become stale. For example, if the response has a Last-Modified header ("last changed by ..."), a cache can send a conditional request with the If-Modified-Since header ("if changed since ...") to determine whether it has changed in the meantime. If the answer is “no”, the content does not need to be sent again.
Invalidation
is usually a side effect of some other request passing the cache. For example, if a URL for which there is a cached response is later addressed with a POST, PUT or DELETE request (see HTTP ) , the cached response is invalidated because the new request has most likely changed it.

Since HTTP 1.1 there is the possibility to transfer the HTTP ETag in the header . It identifies a specific version of a resource.

literature

  • Chris Shiflett: HTTP developer's handbook. Sams Publishing, Indianapolis IN 2003, ISBN 0-672-32454-7 , pp. 157ff.

Web links

Individual evidence

  1. Protocols Standards »Web Cache. Retrieved July 24, 2017 .