I just recently implemented caching on my site, and i have a sweeper
attached to my :update action, to clear my index (which shows top ranked
items). Is it possible to first check to see if there is a change, and
only expire the cache when appropriate??

my index action looks like this:

def index
     unless read_fragment({:page => params[:page] || 1})
        @new_phrases = Phrase.find_top(params[:page]||1)
     end
end

I want my sweeper action to look something like this:

  def expire_cache(phrase)
     if read_fragment({:action => 'index', :page => 1}) ==
Phrase.find_top(1)
         1.upto(5) {|i|  expire_fragment(:action => 'index', :page => i
) }
     end
  end


Rails 2.1.0, ruby 1.8.6. Is this type of behavior possible or reasonable
to implement??
-- 
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-talk@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to