Enable Whole Page Cache For Guest Only

Hi guys,

I want to enable the whole page cache for guest only. How can I do that?

This is what i have now…


public function filters()

{


    return array(

        array(

            'COutputCache',

            'duration'=>100,

        ),

    );


}

Also, can someone please help me understand the varyByParam thing?

Say I have a forum, how can I cache the whole page and in the mean time, user who start a new post can still see their new post?

Thanks!

I solved it like this:




public function filters(){


    $filters = array();


    if(Yii::app()->user->isGuest){

        $filters[] = array(

            'COutputCache + view, 

            'cacheID'=>'filecache',

            'duration'=>8*3600,

            'varyByParam'=>array('id','postUrl', 'tag'),

            'requestTypes'=>array('GET', 'HEAD'),

        );

    }

    return $filters;

}