This website demonstrates how caching works at different levels (browser, cache, server) and what happens when a browser fetches a resource from a server.
The browser caches resources such as images, scripts, and stylesheets. When you visit a website multiple times, the browser retrieves these resources from its local cache instead of the server.
Some servers implement caching mechanisms to reduce server load and improve performance. These caches are often located on the same network as the client's device.
This is the fastest level of caching. It stores resources locally on the user's device.
These are more advanced caches used by some platforms like Google Chrome. They store resources in memory and can be backed by disk storage.
If a cached resource expires, the browser may have to re-fetch it from the server. This process ensures that outdated resources are not displayed.
Invalidate a cache by sending an HTTP cache-control headers with "max-age=0" which forces the browser to request the resource again from the server.
Caching plays a crucial role in improving the performance of web applications by reducing the number of requests made to the server.