On 18 Gen, 10:05, Nicolas CHARLOT <nicolas.char...@gmail.com> wrote: > 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); > } > > }
Nicholas, IMHO your solution is good. I don't know any other solution for a such problem. Why do you say that a double cache is not necessary? Indeed, it's exactly what you need!
-- 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.