Cache Source View

Also, fix a cache-sweeping bug reported,
long ago, by Toby Bartels.
This commit is contained in:
Jacques Distler 2009-12-13 21:09:12 -06:00
parent 1613973929
commit dc3d202665
3 changed files with 5 additions and 4 deletions

View file

@ -2,7 +2,7 @@ module CacheSweepingHelper
def expire_cached_page(web, page_name)
expire_action :controller => 'wiki', :web => web.address,
:action => %w(show published s5 tex print history), :id => page_name
:action => %w(show published s5 tex print history source), :id => page_name
expire_action :controller => 'wiki', :web => web.address,
:action => 'show', :id => page_name, :mode => 'diff'
end

View file

@ -8,6 +8,7 @@ class RevisionSweeper < ActionController::Caching::Sweeper
def before_save(record)
if record.is_a?(Revision)
expire_cached_page(record.page.web, record.page.name)
expire_cached_revisions(record.page)
end
end

View file

@ -9,7 +9,7 @@ class WikiController < ApplicationController
before_filter :load_page
before_filter :dnsbl_check, :only => [:edit, :new, :save, :export_html, :export_markup]
caches_action :show, :published, :authors, :tex, :s5, :print, :recently_revised, :list, :file_list,
caches_action :show, :published, :authors, :tex, :s5, :print, :recently_revised, :list, :file_list, :source,
:history, :revision, :atom_with_content, :atom_with_headlines, :if => Proc.new { |c| c.send(:do_caching?) }
cache_sweeper :revision_sweeper
@ -393,7 +393,7 @@ class WikiController < ApplicationController
return text if text.length <= length
len = length - truncate_string.length
t = ''
text.split.collect do | word|
text.split.collect do |word|
if t.length + word.length <= len
t << word + ' '
else