当然关于 apache squid 等的应用也会有很多技巧
php jsp asp 等很多语言也都有其自身的TIPS和要注意的地方
回到缓存设计
其实也就几个 HTTP Response Header
设置清晰的过期时间
Cache-Control: max-age = 优先级高
Expires: http date
不想cache 设置过期时间为过去
Cache-Crontrol: must-revalidate
想永远cache 设置过期时间为遥远的未来 2038
启发式的
Last-Modified (前面都不设时用 可CGI写或web server配)
ETag
生命期计算age
服务器时间要准 ntpdate rdate
rdate -s server;/sbin/clock –w
max(now-date_value, age_value) + (now - request_time)
过期计算
根据age
后来又演示了一把
Age: 520
X-Cache: HIT from
检查页面元素可缓存性 Cacheability
http://www.web-caching.com/cacheability.html
php jsp asp 等很多语言也都有其自身的TIPS和要注意的地方
回到缓存设计
其实也就几个 HTTP Response Header
设置清晰的过期时间
Cache-Control: max-age = 优先级高
Expires: http date
不想cache 设置过期时间为过去
Cache-Crontrol: must-revalidate
想永远cache 设置过期时间为遥远的未来 2038
启发式的
Last-Modified (前面都不设时用 可CGI写或web server配)
ETag
生命期计算age
服务器时间要准 ntpdate rdate
rdate -s server;/sbin/clock –w
max(now-date_value, age_value) + (now - request_time)
过期计算
根据age
cache headers:
Cache-Control
Cache-Control: max-age=600
Expires: <date in RFC 1123 format>
Expires: Thu, 30 Jun 2005 01:02:39 GMT
Last-Modified (Date)
Sample
PHP:
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Expires: " .gmdate ("D, d M Y H:i:s", time() + 3600 * 24 * 30). " GMT");
ASP:
Response.AddHeader "Last-Modified", RFC1123Date(Now())
Response.Expires = minutes
Response.CacheControl = "public"
Java/JSP:
response.setHeader("Cache-Control","no-cache");
response.setDateHeader ("Expires", 0);
Setting up cache headers in Apache
Expires header
mod_expires mod_headers
LoadModule expires_module libexec/mod_expires.so
LoadModule headers_module libexec/mod_headers.so
AddModule mod_expires.c
AddModule mod_headers.c
...
AddModule mod_gzip.c
ExpiresActive on|off
ExpiresDefault "<base> [plus] {<num> <type>}*"
ExpiresByType type/encoding "<base> [plus] {<num> <type>}*"
A300 #300 seconds after access (A)
mod_cern_meta cern_meta_module 文件级的控制
MetaFiles on
MetaDirectory .web
MetaSuffix .meta
<meta http-equiv="expires" content=<%= new java.util.Date() %>>
Cache-Control
Cache-Control: max-age=600
Expires: <date in RFC 1123 format>
Expires: Thu, 30 Jun 2005 01:02:39 GMT
Last-Modified (Date)
Sample
PHP:
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Expires: " .gmdate ("D, d M Y H:i:s", time() + 3600 * 24 * 30). " GMT");
ASP:
Response.AddHeader "Last-Modified", RFC1123Date(Now())
Response.Expires = minutes
Response.CacheControl = "public"
Java/JSP:
response.setHeader("Cache-Control","no-cache");
response.setDateHeader ("Expires", 0);
Setting up cache headers in Apache
Expires header
mod_expires mod_headers
LoadModule expires_module libexec/mod_expires.so
LoadModule headers_module libexec/mod_headers.so
AddModule mod_expires.c
AddModule mod_headers.c
...
AddModule mod_gzip.c
ExpiresActive on|off
ExpiresDefault "<base> [plus] {<num> <type>}*"
ExpiresByType type/encoding "<base> [plus] {<num> <type>}*"
A300 #300 seconds after access (A)
mod_cern_meta cern_meta_module 文件级的控制
MetaFiles on
MetaDirectory .web
MetaSuffix .meta
<meta http-equiv="expires" content=<%= new java.util.Date() %>>
后来又演示了一把
Age: 520
X-Cache: HIT from
检查页面元素可缓存性 Cacheability
http://www.web-caching.com/cacheability.html
pthread编程手册
炒股要有三闲境界

2007/05/28 23:26 | by 
这里有参考的内容
这个也不错。