Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

A slight improvement in the efficiency of the Cache Sweeper

Suggested by Andrew Stacey
  • Loading branch information...
commit b6c0ffa0d54289bed959bdcbaa68693abec7e783 1 parent d30bd11
@distler distler authored
Showing with 10 additions and 2 deletions.
  1. +10 −2 app/controllers/revision_sweeper.rb
View
12 app/controllers/revision_sweeper.rb
@@ -18,7 +18,15 @@ def after_save(record)
expire_caches(record.page)
end
end
-
+
+ def after_create(record)
+ if record.is_a?(Page)
+ WikiReference.pages_that_reference(record.web, record.name).each do |page_name|
+ expire_cached_page(record.web, page_name)
+ end
+ end
+ end
+
def after_delete(record)
if record.is_a?(Page)
expire_caches(record)
@@ -33,7 +41,7 @@ def self.expire_page(web, page_name)
def expire_caches(page)
expire_cached_summary_pages(page.web)
- pages_to_expire = ([page.name] + WikiReference.pages_that_reference(page.web, page.name) +
+ pages_to_expire = ([page.name] +
WikiReference.pages_redirected_to(page.web, page.name) +
WikiReference.pages_that_include(page.web, page.name)).uniq
pages_to_expire.each { |page_name| expire_cached_page(page.web, page_name) }
Please sign in to comment.
Something went wrong with that request. Please try again.