What is web caching?

The web cache stores recently requested objects in its memory. When requests for these objects are placed again, the cache (not the original server) services these HTTP requests. If the requested object is not available in the cache, then the web cache contacts the original server to obtain the object. The purpose of caching is to reduce response time by avoiding calls to the actual webserver.

svg viewer

Steps

The following steps demonstrate how web caching works:

  1. The user’s browser makes an HTTP request for the desired object to the web cache.

  2. If the web cache does not have this object in its memory, it requests the original server for the file, sends the object to the user’s browser, and stores a copy of it along with the last-modified date of the object.

  3. When another user requests the same object, the object is available in the cache. Before sending the object to the requesting user, the cache needs to ensure that this object has not been modified on the original server.

  4. The web cache sends a conditional GET request to the original webserver, i.e., it tells the webserver to send the file only if it has been modified since the web cache’s last-modified date.

  5. If the object has not been modified at the original web server, then the response message will not contain the requested object, and the web cache will service the user’s request using the object in its memory.

Free Resources

Copyright ©2024 Educative, Inc. All rights reserved