From 56dc390ddbc258dda97e692485bebd19fd3a6f4c Mon Sep 17 00:00:00 2001 From: Alexey Verkhovsky Date: Sun, 2 Apr 2006 05:47:41 +0000 Subject: [PATCH] Improved cache sweeping for All Pages and Recently Revised (categories stuff again) --- app/controllers/revision_sweeper.rb | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/app/controllers/revision_sweeper.rb b/app/controllers/revision_sweeper.rb index 72231d1d..d77d644b 100644 --- a/app/controllers/revision_sweeper.rb +++ b/app/controllers/revision_sweeper.rb @@ -23,10 +23,16 @@ class RevisionSweeper < ActionController::Caching::Sweeper :action => %w(show published), :id => page_name end - expire_action :controller => 'wiki', :web => web.address, - :action => %w(authors recently_revised list) - expire_fragment :controller => 'wiki', :web => web.address, - :action => %w(rss_with_headlines rss_with_content) + categories = WikiReference.find(:all, :conditions => "link_type = 'C'") + %w(recently_revised list).each do |action| + expire_action :controller => 'wiki', :web => web.address, :action => action + categories.each do |category| + expire_action :controller => 'wiki', :web => web.address, :action => action, :category => category.referenced_name + end + end + + expire_action :controller => 'wiki', :web => web.address, :action => 'authors' + expire_fragment :controller => 'wiki', :web => web.address, :action => %w(rss_with_headlines rss_with_content) end end