aboutsummaryrefslogtreecommitdiffstats
path: root/app/sweepers/refinery/blog_sweeper.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/sweepers/refinery/blog_sweeper.rb')
-rw-r--r--app/sweepers/refinery/blog_sweeper.rb25
1 files changed, 25 insertions, 0 deletions
diff --git a/app/sweepers/refinery/blog_sweeper.rb b/app/sweepers/refinery/blog_sweeper.rb
new file mode 100644
index 0000000..adf97fc
--- /dev/null
+++ b/app/sweepers/refinery/blog_sweeper.rb
@@ -0,0 +1,25 @@
+module Refinery
+ class BlogSweeper < ActionController::Caching::Sweeper
+ observe BlogPost, BlogComment
+
+ def after_create(record)
+ expire_cache_for(record)
+ end
+
+ def after_update(record)
+ expire_cache_for(record)
+ end
+
+ def after_destroy(record)
+ expire_cache_for(record)
+ end
+
+ private
+
+ def expire_cache_for(record)
+ expire_page '/blog'
+ expire_page '/blog/feed.rss'
+ end
+
+ end
+end