While studying the caching strategies adopted by various search engine websites and Stackoverflow itself, I can’t help but notice the subtle differences in the response headers:
Google Search
Cache-Control: private, max-age=0
Expires: -1
Yahoo Search
Cache-Control: private
Connection: Keep-Alive
Keep-Alive: timeout=60, max=100
Stackoverflow Search
Cache-Control: private
There must be some logical explanation behind the settings adopted. Can someone care to explain the differences so that everyone of us can learn and benefit?
From RFC2616 HTTP/1.1 Header Field Definitions, 14.9.1 What is Cacheable:
max-age=0means that it may be cached up to 0 seconds. The value zero would mean that no caching should be performed.Expires=-1should be ignored when there’s amax-agepresent, and -1 is an invalid date and should be parsed as a value in the past (meaning already expired).From RFC2616 HTTP/1.1 Header Field Definitions, 14.21 Expires:
The
Connection: Keep-AliveandKeep-Alive: timeout=60, max=100configures settings for persistent connections. All connections using HTTP/1.1 are persistent unless otherwise specified, but these headers change the actual timeout values instead of using the browsers default (which varies greatly).