How does the web server expire a cached object?
There are several ways the browser or ProxySG can determine if it should serve a cached object, or retrieve fresh copy from the web server.
Caching Method 1: Last-Modified
Last-modified: Fri, 16 Mar 2007 04:00:25 GMT
Caching Method 2: ETag
ETags to the rescue. An ETag is a unique identifier given to every file, and behaves like a hash or fingerprint: every file gets a unique fingerprint, and if you change the file (even by one byte), the fingerprint changes as well.
Instead of sending back the modification time, the server can send back the ETag (fingerprint):
The ETag can be any string which uniquely identifies the file. The next time the browser needs a file, it knows if it is getting the latest ETag.
Caching Method 3: Expires
Expires: Tue, 20 Mar 2007 04:00:25 GMT
In the meantime, we avoid even talking to the server if we’re in the expiration period.
There isn’t a conversation here; the browser has a monologue.
The web server didn’t have to do anything, and the user sees the file instantly.
Caching Method 4: Max-Age
Max-Age is measured in seconds. Here’s a few quick second conversions:
1 day in seconds = 86400
Bonus Header: Public and Private
The cache headers never cease. Sometimes a server needs to control when certain resources are cached.
Cache-control: public means the cached version can be saved by proxies and other intermediate servers, where everyone can see it.
However, be wary that some cache directives only work on newer HTTP 1.1 browsers. If you are doing special caching of authenticated pages then read more about caching from the web/google.
Rate this Page
Please take a moment to complete this form to help us better serve you.