Caching Lifetime / Freshness Lifetime

The Caching Lifetime of a file is simply the description of how long it can be stored from the time it was first requested, before it must be retrieved freshly from the server. The Caching Lifetime is expressed as a ‘Cache Control: max-age=’ and is measured in seconds. Something similar can also be expressed with ‘Expires:’ and a full date including the day, hour, minute and time zone, like this: Tue, 15 May 2007 07:19:00 GMT. There are existing free library files that can help you construct these dates accurately. The longest cache time you can use with HTTP headers is 24 hours, so if you want to do that, use ‘max-age: 86400’. Either can be sent in the HTTP Header, which is created and sent by the server. When both Cache-Control and Expires are present, Cache-Control takes precedence.