On 1 Dec 2009, at 13:46, Timmipetit wrote:

> Now let's say that messages will be created/edited/deleted in 2
> modules in the frontend, and maybe also from the backend (or even a
> plugin). When this happens, the cached partial from that user should
> be deleted.
> The easiest way to do this in this situation would probably be from
> the model, right? If you would automatically delete the cache in the
> model, it doesn't matter where messages are edited. But I'm not quite
> sure if this seems right from a MVC point of view.
> How would you do this, and why?

Whilst I'm still not convinced it's the "best" approach (but one that I'm 
currently using... for now), you could fire an event from your model, which an 
observer would use to clear the cache.

This is a little cleaner as it loosely couples the model to the caching 
implementation, and means your event and observer are reusable. It also means 
that your model is reusable in a scenario where you don't want this behaviour 
(for instance, when used with webservices)

I think the "best" approach would be to use an AOP advice around the 
save/update methods on your message model... but at least for now, symfony 
doesn't have AOP.

--

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