public function filters() {
return array(
array(
'COutputCache + show',
'duration' => 3600 * 8,
'varyByParam' => array('id'),
'dependency' => array(
'class' => 'CDbCacheDependency',
'sql' => 'SELECT title,content from {{post}} where id=:id',
'params' => array(':id' => $_GET['id']),
)
)
);
}
dependency 缓存依赖 CDbCacheDependency 当数据库变动时,缓存更新
所有依赖关系必须实现 ICacheDependency接口 CCacheDependency
网上基本都是单页面缓存的依赖关系例子 如 select max(id) from xxx