The cache server software aims for a reasonable compromise between ensuring that a document is up-to-date, and providing a cached copy. The question is, how can you be sure that the information you are looking out is up-do-date, or has it has been sitting in the local cache for several days?
- Any requests to a
cgi-binURL will definitely be up-to-date, as such URLs can't be cached.
- If the object has an
Expires:header which is earlier than the current date, the object is stale, otherwise the object is fresh. If the object is stale, the server goes off to the originating server to see if the object has been updated there; if it has, the server retrieves the updated object.
- If an object has been in the cache for three days or longer, the server regards it as being stale.
- If you are not sure if the document you requested is up-to-date, clicking the "Reload" button on your browser will force the cache to assume that the object is "stale".
The following diagram shows the freshness algorithm used by Squid (thanks to Kolics Berthold):