This is the 7th day of my participation in the August Text Challenge.More challenges in August !

Classification:

A picture is illustrated first

What is HTTP caching?

When a client requests a resource from the server, it arrives in the browser cache first, and if the browser has a copy of the resource to request, it can fetch the resource directly from the browser cache rather than from the original server

HTTP cache classification:

According to whether need to request to the server by classification, can be divided into (mandatory cache to cache) through consultation according to whether can be used by single or multiple users to classification, can be divided into the cache (private cache, Shared cache) mandatory if effective, no longer need to interact with the server, and negotiate the cache whether effective or not, all need to interact with the server.

Mandatory cache vs. negotiated cache:

HTTP caching process:

The first time a browser makes an HTTP request to a Web server, the server returns the requested resource and adds cache-specific fields such as Cache-Control, Expires, Last-Modified, ETag, Date, and so on to the response header. The browser then requests the resource from the server and can use strong and negotiated caching as appropriate

  • Strong cache: The browser fetches data directly from the local cache without interacting with the server.
  • Negotiated cache: The browser sends a request to the server, and the server determines whether the local cache can be used.
  • Connection and difference: Both caches end up using local caches; The former does not interact with the server, the latter does.

The following assumes that the browser has visited the server, that the server returns the cache-relevant header field, and that the browser has cached the relevant resources. Strong and negotiated caches are analyzed as follows:

What are the benefits of using HTTP caching?

  1. Reduce redundant data transmission and save network costs
  2. Relieved the server pressure, greatly improved the performance of the site
  3. Accelerated client loading web page speed

Extension:

Common browser caches include cookie, sessionStorage, and localStorage.