Le 18 janv. 2010 à 08:43, Alexandru-Emil Lupu a écrit :

> Check here: 
> 
> http://www.symfony-project.org/book/1_2/12-Caching
> 
> Some of the things that can be found in 1.2 are still valable in sf 1.4

Ok, but I don't see how slots can help for my purpose.

I need to store 2 versions of a same action depending on user status 
(authenticated and member or not).

The solution I founded was to write my own viewCacheManager:
It works but all actions are cached twice and it's not necessary. I'm looking 
for the best practice to do that.

<?php

class myViewCacheManager extends sfViewCacheManager 
{
  public function generateCacheKey($internalUri, $hostName = '', $vary = '', 
$contextualPrefix = '')
  {
    $internalUri .= strpos($internalUri, '?') !== false ? '&member=' : 
'?member=';
    $internalUri .= 
sfContext::getInstance()->getUser()->canViewRestrictedMemberContent() ? '1' : 
'0';
    
    return parent::generateCacheKey($internalUri, $hostName, $vary, 
$contextualPrefix);
  }
}
--
You received this message because you are subscribed to the Google Groups "symfony users" group.
To post to this group, send email to symfony-us...@googlegroups.com.
To unsubscribe from this group, send email to symfony-users+unsubscr...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/symfony-users?hl=en.

Reply via email to