关于 Cache(1)

Posted on 28th July 2004 by Nio in Cache, 程序人生

今天看到 PHP Everywhere 中有一篇关于 Cache 的文章:The Way of the Cache。文中谈到一个关于各种 PHP CMS Cache 的 benchmark,参与比较的 PHP CMS 包括:* e107 0.615
* Drupal 4.4.2
* Xoops 2.0.7
* Manbo 4.5
* Post-Nuke
* Xaraya 0.9.9

image

image

image

image

另外,文中还提到过在 WEB 应用程序中使用 Cache 的几种方式:# A caching library. I like Cache_Lite if you want to store the HTML in a file. Or you can cache the HTML in a database; Drupal does this.

# Find all commonly rendered HTML that does not require personalization, eg. articles, navigation toolbars, etc, and customize the relevant display code to cache the HTML. It helps if you have a simple UI, with the ability to render by area or block (eg. Left Column, Right Column, Main Article Area).

# For each area to be cached, determine a hashing algorithm for the item you want to cache. A simple one would be md5($HTML_BLOCK_NAME.$article_id). If you can cache the whole page (e.g. no user has logged in), even better.

# Decide on the cache invalidation events, such as "on procreate", "on mutilate", "on dismember" and "on timeout".
比较令我感兴趣的是使用数据库保存 Cache 页面,以前都是直接使用静态 HTML 文件做 Cache,或者将首页分成多个组合部分,对每个部分分别生成静态文件做 Cache。改天有时间可以测试一下使用数据库 Cache 页面的性能如何。

1 Comment »

  1. 很好的站点,很好的文章.

    难怪e107总是在php开源cms里排名第一呢

    Comment by lidan.info — August 22, 2006 @ 8:49 am

Leave a comment