Cache-Control
was introduced in HTTP/1.1 and offers more options than Expires
. They can be used to accomplish the same thing but the data value for Expires
is an HTTP date whereas Cache-Control
max-age lets you specify a relative amount of time so you could specify "X hours after the page was requested".
HTML Cache control is a very similar question and has a good link to a caching tutorial that should answer most of your questions (e.g., http://www.mnot.net/cache_docs/#EXPIRES). To sum up though, Expires
is recommended for static resources like images and Cache-Control
when you need more control over how caching is done.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…