Invalidating a cache

Fetching something over the network is both slow and expensive.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.All you need to do is ensure that each server response provides the correct HTTP header directives to instruct the browser on when and for how long the browser can cache the response.

Every time the user requests this asset, a request is sent to the server and a full response is downloaded.By contrast, the browser can cache "private" responses.However, these responses are typically intended for a single user, so an intermediate cache is not allowed to cache them.For example, in the above exchange, the server returns a 1024-byte response, instructs the client to cache it for up to 120 seconds, and provides a validation token ("x234dff") that can be used after the response has expired to check if the resource has been modified.Assume that 120 seconds have passed since the initial fetch and the browser has initiated a new request for the same resource.

Search for invalidating a cache:

invalidating a cache-73invalidating a cache-86

First, the browser checks the local cache and finds the previous response.

Leave a Reply

Your email address will not be published. Required fields are marked *

One thought on “invalidating a cache”