Steven Cummings wrote:
> 
> Had this problem too and wrote up the solution the other night on my 
> blog.
> 
> http://stevencummings.name/2010/09/07/expire_fragment-with-rake-and-as-a-model-only-observer

Interesting solution...

Related to model-based cache expiration, in one large-ish Rails project, 
the sidebar for a 'show' of an entity contains a view of all the related 
entities in the application. We were getting hammered on both db access 
and rendering time, so I implemented fragment caching in a multi-tiered 
approach, and left it to the models to expire caches of their data -- a 
fine line to walk, but that worked the best for us.

We used a Rails.cache.delete() call from within the model to handle the 
fragment expiration, with the new/edited/deleted model selecting the 
appropriate caches to expire according to its related models.

-- 
Posted via http://www.ruby-forum.com/.

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to