No, we use a filter class. The filter.yml entry is the following:

conditionalCache:
  # all pages added to this are cached only for anonymous users
  class: ConditionalCacheFilter
  param:
    pages:
      - { module: home, action: index, ttl: 3600, withLayout: true }

The ConditionalCacheFilter class looks like this:

class ConditionalCacheFilter extends sfFilter
{
  public function execute($filterChain)
  {
    $context = $this->getContext();

    if (($cache = $context->getViewCacheManager()))
    {
      if (!$context->getUser()->isAuthenticated())
      {
        foreach ((array)$this->getParameter('pages') as $page)
        {
          if (!isset($page['withLayout']))
          {
            $page['withLayout'] = false;
          }
          $cache->addCache($page['module'], $page['action'], array('lifeTime' 
=> $page['ttl'], 'withLayout' => $page['withLayout']));
        }
      }
    }
    // Execute next filter
    $filterChain->execute();
  }
}

On Jul 26, 2010, at 11:58 , Georg wrote:

> Do you have with_layout: true in your cache.yml?
> 
> Am 26.07.2010 11:17, schrieb Lea Hänsenberger:
>> Hi Georg,
>> 
>> Ok, I tried with disabling all the firefox addons, clearing the cache and 
>> sending the cache headers in both the homepage action and the login action. 
>> I encountered the same behaviour.
>> If I check the http response on the login page I see the headers I sent. On 
>> the homepage they seem to be overwritten by the cache filter. 
>> After the login I'm being redirected to the homepage, but the homepage is 
>> not re-requested from the server anymore (in firebug's net tab there is no 
>> request to the homepage).
>> 
>> Cheers,
>> Lea
>> 
>> On Jul 26, 2010, at 10:54 , Georg wrote:
>> 
>>> Lea,
>>> 
>>> does this happen also on a firefox out of the box (meaning have you some
>>> add-ons that mess up your firefox's cache?) because I do not expirience
>>> this behaviour.
>>> And are you sending the cache headers on the homepage before login?
>>> And have you cleared the firefox's cache before doing another test?
>>> I know, simple things, just to be sure...
>>> 
>>> HTH Georg
>>> 
>>> Am 26.07.2010 10:28, schrieb Lea Haensenberger:
>>>> Hi,
>>>> 
>>>> I just tried that, it didn't change anything.
>>>> 
>>>> On Jul 23, 1:16 am, Gustavo Adrian <[email protected]>
>>>> wrote:
>>>>> Hi,
>>>>> 
>>>>> Did you try to disable local caching on the action with headers
>>>>> "Cache-control" and "Pragma" to see what happens?
>>>>> 
>>>>> $this->getResponse()->setHttpHeader("Cache-Control", "no-cache");
>>>>> $this->getResponse()->setHttpHeader("Pragma", "no-cache");
>>>>> $this->getResponse()->setHttpHeader("Expires", 0);
>>>>> 
>>>>> On Thu, Jul 22, 2010 at 11:37 AM, Lea Haensenberger 
>>>>> <[email protected]>wrote:
>>>>> 
>>>>> 
>>>>> 
>>>>>> I found out that when disabling the memory cache in firefox or when
>>>>>> setting check.doc_frequency to 1, i.e. request page on every load,
>>>>>> everything works fine. doc_frequency is usually set to 3, i.e. check
>>>>>> validity of the page by looking at the modified date and reload if
>>>>>> necessary, and the modified date changes when going back to the
>>>>>> homepage but the page is not actually reloaded.
>>>>> 
>>>>>> Maybe with that additional information someone can help me solve that
>>>>>> problem!?
>>>>> 
>>>>>> Cheers,
>>>>>> Lea
>>>>> 
>>>>>> On Jul 22, 10:42 am, Lea Haensenberger <[email protected]> wrote:
>>>>>>> Does nobody know that problem? I'm a bit lost and I'll have to turn
>>>>>>> offcachingif we can't solve the problem.
>>>>>>> Does anyone have any idea what could be the reason for that behaviour?
>>>>> 
>>>>>>> Lea
>>>>> 
>>>>>>> On Jul 16, 3:52 pm, pghoratiu <[email protected]> wrote:
>>>>> 
>>>>>>>> Do you have this behavior also with the development controller
>>>>>>>> (frontend_dev.php)?
>>>>> 
>>>>>>>>  gabriel
>>>>> 
>>>>>>>> On Jul 16, 4:09 pm, Lea Haensenberger <[email protected]> wrote:
>>>>> 
>>>>>>>>> I've encountered a strange problem with firefox andcaching. When I
>>>>>>>>> log in and get redirected to the homepage afterwards I don't see that
>>>>>>>>> I'm logged in. If I have a look at
>>>>>> context->getUser()->isAuthenticated() I get 'false'. After manually
>>>>>> reloading the
>>>>> 
>>>>>>>>> homepage everything is fine. I already tried invalidating the cache
>>>>>> on
>>>>>>>>> log in, doesn't help.
>>>>>>>>> It works fine in Safari.
>>>>>>>>> Does anyone have an idea what happens with firefox here?
>>>>> 
>>>>>>>>> Cheers,
>>>>>>>>> Lea
>>>>> 
>>>>>> --
>>>>>> If you want to report a vulnerability issue on symfony, please send it to
>>>>>> security at symfony-project.com
>>>>> 
>>>>>> You received this message because you are subscribed to the Google
>>>>>> Groups "symfony users" group.
>>>>>> To post to this group, send email to [email protected]
>>>>>> To unsubscribe from this group, send email to
>>>>>> [email protected]<symfony-users%2bunsubscr...@goog
>>>>>>  legroups.com>
>>>>>> For more options, visit this group at
>>>>>> http://groups.google.com/group/symfony-users?hl=en
>>>> 
>>> 
>>> -- 
>>> If you want to report a vulnerability issue on symfony, please send it to 
>>> security at symfony-project.com
>>> 
>>> You received this message because you are subscribed to the Google
>>> Groups "symfony users" group.
>>> To post to this group, send email to [email protected]
>>> To unsubscribe from this group, send email to
>>> [email protected]
>>> For more options, visit this group at
>>> http://groups.google.com/group/symfony-users?hl=en
>> 
> 
> -- 
> If you want to report a vulnerability issue on symfony, please send it to 
> security at symfony-project.com
> 
> You received this message because you are subscribed to the Google
> Groups "symfony users" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://groups.google.com/group/symfony-users?hl=en

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

You received this message because you are subscribed to the Google
Groups "symfony users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en

Reply via email to