how do we specify something as cacheable?

Started by sukishan, Aug 22, 2009, 06:38 PM

Previous topic - Next topic

sukishan

Cache-Control: max-age=specify a duration in seconds

or

Expires: a GMT date in the format specified by RFC 1123

Only one of these is needed, but if both headers are present in the server response for some inexplicable reason, the Cache-Control header takes priority over the Expires header.


If you use the Cache-Control header, the cache entry will be considered fresh until the duration that you specified (in seconds) has elapsed.
If you use the Expires header, on the other hand, the cache entry is considered to be fresh until the expired date arrives. The RFC 1123 standard specifies the following date time format: Thu, 01 Jan 2008 13:37:41 GMT.

To specify an expiration time in the near future, it's better to use the max-age directive in the Cache-Control header, to avoid clock synchronization errors between the browser and the server. For expiration times far into the future, the Expires header is a safer bet—it's more readable to humans and less error prone.
A good beginning makes a good ending