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(







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?


I solved it like this:

public function filters(){

    $filters = array();


        $filters[] = array(

            'COutputCache + view, 



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

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



    return $filters;