I''ve written a plugin to allow for time based fragment caching. It lets you do things like: <% cache ''fragment_name'', 10.minutes.from_now do %> <p>something intensive which will be cached for 10 minutes</p> <% end %> Also, there''s a convenience method so that in your controllers you can do: when_fragment_expired ''fragment_name'', 10.minutes_from_now do @stuff = do_something_intensive end This will check the fragment cache, see if it''s expired and if so it will execute the code in the block. It deals with expiring the fragment itself, so if using this you don''t need to have the expiry time in your views and you can keep yourself DRY by having the expiry time in just one place. Hopefully it''s of use to someone. SVN repo is here: http://svn.livsey.org/plugins/timed_fragment_cache/ More details on my blog: http://livsey.org/articles/2006/08/25/timed_fragment_cache-plugin-fragment-caching-with-time-based-expiry Thanks. -- Richard Livsey http://livsey.org --~--~---------~--~----~------------~-------~--~----~ 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-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---
I have recently released a very similar plugin, except mine is designed to work with the robot coop memcache-client (memcache supports time expiry without using meta fragments) Syntax is similar to Richard''s <% cache ''key'', :expire => 10.minutes do %> <p>stuff</p> <% end %> Blog: http://skwp.wordpress.com/2006/08/19/rails-fragment-cache-with-memcached-client-and-time-based-expire-option/ Rubyforge: http://rubyforge.org/projects/mcache-fragment/ Sorry if this was already posted, I don''t remember if I wrote to the list or not. thanks -- Yan Pritzker http://planyp.us http://skwp.wordpress.com On Fri, 25 Aug 2006 13:31:22 -0500, Richard Livsey <richard-gfRugNUWsoQdnm+yROfE0A@public.gmane.org> wrote:> > I''ve written a plugin to allow for time based fragment caching. It lets > you do things like: > > <% cache ''fragment_name'', 10.minutes.from_now do %> > <p>something intensive which will be cached for 10 minutes</p> > <% end %>--~--~---------~--~----~------------~-------~--~----~ 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-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---