Hi
Is there a yii-way to avoid caching for specific requests on the same controller/action ?
For example I have an action that may have a sorting parameter in the url
(I want cache all categories)
http://www.mydomain.com/index.php?r=site/categories/3 (main request category=1,2…)
(I don’t want cache all categories by sorting)
http://www.mydomain.com/index.php?r=site/categories/3&sort=desc (specific request category=1,2… with sorting)
Because there are a lot of combination of categories and sorting, I want to cache only the main cases of categories,
I found requestTypes in COutputCache class to exclude caching but this is only for the type Request (GET,POST)
So, How to exclude the caching for sorting?
P.S. I could have this code
$exclude = isset($_GET['sort']);
$c = false;
if (!$exclude) {
$c = ($this->beginCache('an_id', array('varyByParam' => array('cid')));
}
//
//---- the content ----
//
if ($c) {
$this->endCache();
}
But I don’t know if its tricky way…