preface

As web front-end development, dealing with the browser is the most common thing we do, and the browser will often carry out the relevant resource cache operation, when we initiate a resource request, the browser may directly read the resource from the cache, so how does the browser control the request whether to use the cache? That’s what we’re talking about here.

What is HTTP caching?

HTTP cache is when the browser initiates various resource requests, the browser directly reads the resources from the cache area and returns them to the application program according to certain field configurations.

What is the representation of HTTP caching?

HTTP caching can be seen in our browser’s network, and here we use Chrome as an example:

As you can see in the Size column, there are two modes: memory cache and disk cache.

Classification of HTTP caches

HTTP cache can only control disk cache, while memory cache is controlled by the browser.

HTTP caching is divided into:

1. Strong cache (browser reads resources directly from disk cache without negotiation with server)

2. Negotiate cache (browser needs to negotiate with server before reading disk cache resources)

For those of you who want to continue, move on to the next chapter on strong caching