This forum is in READ-ONLY mode.
You can look around, but if you want to ask a new question, please use the new forum.
Home » support » General discussion » Cache and Session state
Cache and Session state [message #103478] Tue, 03 August 2010 14:22 Go to next message
pulse00  is currently offline pulse00
Messages: 25
Registered: June 2008
Junior Member
Hi all,

i'm having the following caching problem, and am seeking advice for best practices how to handle this:

In a partial, some elements are only rendered, when the user is logged in and when he/she has specific credentials. The url for the page which renders the partial is always the same, no matter if the user is logged in or not / has credentials or not:

The problem is, when the partial on that specific page is already in the cache from a non-logged in user, the user which should see the html element does not see it, because the cached version did not render it.

The only way i could think of at the moment, is to generate a different url for these types of users, like:

Any hints how to solve this issue?


Re: Cache and Session state [message #103481 is a reply to message #103478 ] Tue, 03 August 2010 14:37 Go to previous message
halfer  is currently offline halfer
Messages: 9535
Registered: January 2006
Location: West Midlands, UK
Faithful Member
Yes, when you call include_partial(), change the parameters you supply to it according to how you want it cached - even if you don't subsequently use those parameters inside the partial. Symfony will then cache those items separately.

In your case, you could pass $sf_user->hasCredential('editor') to the partial.

Remember Palestine
Previous Topic:Differents domains with differents databases
Next Topic:InvalidArgumentException Error "A field must be an instance of sfWidget."
Goto Forum:

powered by FUDforum - copyright ©2001-2004 FUD Forum Bulletin Board Software