Hi there,
here is my problem, or doubt: I have a menu, which varies depending on the user id, so, one user could see some options and another user some different options, depending on the privileges assigned to each one. I think that setting the cache $id to something which includes the user’s id would solve this situation (please correct me if I’m wrong). But I also need to refresh the cache if the user logs out and logs in again, because some privilege could have been changed meanwhile, and I don’t want him to wait up to one hour (that’s my cache duration) to see the new options in the menu. So, I’m using this:
if ($this->beginCache(sha1('mainMenu_'.Yii::app()->user->id), array('duration'=>3600, 'varyBySession'=>true))) {
// menu here
$this->endCache();
Would this be right? Also, does this create an entry in the cache for every opened session?
Thanks.