Invalidating a cache

Posted by / 23-Jun-2017 09:11

As a result, if a proper validation token (ETag) is present, no-cache incurs a roundtrip to validate the cached response, but can eliminate the download if the resource has not changed. It simply disallows the browser and all intermediate caches from storing any version of the returned response—for example, one containing private personal or banking data.Every time the user requests this asset, a request is sent to the server and a full response is downloaded.In the preceding example, the client automatically provides the ETag token in the "If-None-Match" HTTP request header.

However, these responses are typically intended for a single user, so an intermediate cache is not allowed to cache them.

For example, a user's browser can cache an HTML page with private user information, but a CDN can't cache the page.

This directive specifies the maximum time in seconds that the fetched response is allowed to be reused from the time of the request.

If the token hasn't changed, the server returns a "304 Not Modified" response, which tells the browser that the response it has in cache hasn't changed and can be renewed for another 120 seconds.

Note that you don't have to download the response again, which saves time and bandwidth.

invalidating a cache-18invalidating a cache-28invalidating a cache-18

Check your server documentation for the necessary configuration flags.