Squid 缓存加速与CMS系统设计

| |
[不指定 2007/05/28 23:26 | by zeus ]
当然关于 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


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() %>>


后来又演示了一把
Age: 520
X-Cache: HIT from

检查页面元素可缓存性 Cacheability
http://www.web-caching.com/cacheability.html
没有分类 | 评论(5) | 引用(0) | 阅读(2155)
zeus Email Homepage
2007/05/28 23:28
http://blog.csdn.net/zns2002/archive/2006/04/06/653068.aspx

这里有参考的内容
zeus Email Homepage
2007/05/28 23:30
http://vancouver-webpages.com/CacheNow/detail.html

这个也不错。
鲜花
2008/01/28 10:17
2231
2008/04/17 19:21
shuaishuai
1234
2008/04/17 19:22
badbadbadbadbadbadbadbadbadbadbadbad
分页: 1/1 第一页 1 最后页
发表评论
表情
emotemotemotemotemot
emotemotemotemotemot
emotemotemotemotemot
emotemotemotemotemot
emotemotemotemotemot
打开HTML
打开UBB
打开表情
隐藏
昵称   密码   游客无需密码
网址   电邮   [注册]
               

验证码 不区分大小写