各位大大好, 初學 yii, 有些問題請教
近日使用 coutputcache , 但是發現 他會整頁緩存, 甚至所有 action 的 function 也都會
以下附上我的設定, 請大大們幫我看看是哪裡出了問題? 感激不盡
/protected/config/main.php
'cache' => array (
'class' => 'CFileCache',
'directoryLevel' => 1,
),
/protected/modules/home/controllers/DefaultController.php
//file cache
public function filters()
{
return array(
array(
'COutputCache + index',
'duration' => ($_GET['nocache']) ? 0 : 86400,
'varyByExpression' => Yii::app()->user->id,
),
);
}
/protected/modules/poi/controllers/StageController.php
public function filters()
{
return array(
array(
'COutputCache + Index',
'duration' => ($_GET['nocache']) ? 0 : 86400,
'varyByExpression' => Yii::app()->user->id,
),
array(
'COutputCache + View',
'duration' => ($_GET['nocache']) ? 0 : 86400,
'varyByParam' => array('id'),
'varyByExpression' => Yii::app()->user->id,
),
array(
'COutputCache + List',
'duration' => ($_GET['nocache']) ? 0 : 86400,
'varyByExpression' => yii::app()->request->requestUri,
),
);
}
最後的那個 poi module 內的 controller , 甚至會 cache 到其他 controller 的頁面緩存
實在試不出其他的方法
有比較熟 outputcache 的大大可以給予些意見嗎?