Sha256: 964c271f42580e94aa2f035982136013fc0166c6c0b74837e50f07293c1357d4
Contents?: true
Size: 1.21 KB
Versions: 16
Compression:
Stored size: 1.21 KB
Contents
class SpudPostCategorySweeper < ActionController::Caching::Sweeper observe SpudPostCategory def after_save(record) expire_cache_for(record) end def after_destroy(record) expire_cache_for(record) end private def expire_cache_for(record) if Spud::Blog.config.cache_mode = :action SpudPost.find_each do |p| if p.is_news && Spud::Blog.config.news_enabled expire_action news_post_url(p.url_name) elsif Spud::Blog.config.blog_enabled expire_action blog_post_url(p.url_name) end end expire_action news_url if Spud::Blog.config.news_enabled expire_action blog_url if Spud::Blog.config.blog_enabled expire_action spud_blog_sitemap_url end if Spud::Blog.config.cache_mode = :full_page SpudPost.find_each do |p| if p.is_news && Spud::Blog.config.news_enabled expire_page news_post_path(p.url_name) elsif Spud::Blog.config.blog_enabled expire_page blog_post_path(p.url_name) end end expire_page news_path if Spud::Blog.config.news_enabled expire_page blog_path if Spud::Blog.config.blog_enabled expire_page spud_blog_sitemap_path(:format => :xml) end end end
Version data entries
16 entries across 16 versions & 2 rubygems