Updating cache

Large responses require many roundtrips between the client and server, which delays when they are available and when the browser can process them, and also incurs data costs for the visitor.As a result, the ability to cache and reuse previously fetched resources is a critical aspect of optimizing for performance.Assume that 120 seconds have passed since the initial fetch and the browser has initiated a new request for the same resource.First, the browser checks the local cache and finds the previous response.This is done by doing a force refresh by pressing both control and F5 buttons simultaneously on your keyboard (depending on your browser).

Also when the cache fills up, performance can slow down and your hard drive may run out of space.If the fingerprint is still the same, then the resource hasn't changed and you can skip the download.In the preceding example, the client automatically provides the ETag token in the "If-None-Match" HTTP request header.The server generates and returns an arbitrary token, which is typically a hash or some other fingerprint of the contents of the file.The client doesn't need to know how the fingerprint is generated; it only needs to send it to the server on the next request.

Leave a Reply