Sha256: 3b9c1423c412ed175747ab6566e9fe6ab17e2b985935b8e717c4798ed501259b
Contents?: true
Size: 1.3 KB
Versions: 5
Compression:
Stored size: 1.3 KB
Contents
class SpudPostSweeper < ActionController::Caching::Sweeper observe SpudPost def after_create(record) expire_cache_for(record) end def before_update(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.enable_action_caching expire_action spud_blog_sitemap_url if !record.is_news && Spud::Blog.config.blog_enabled expire_action blog_url expire_action blog_url(:format => :rss) expire_action blog_post_url(record.url_name) elsif Spud::Blog.config.news_enabled expire_action news_url expire_action news_url(:format => :rss) expire_action news_post_url(record.url_name) end end if Spud::Blog.config.enable_full_page_caching expire_page spud_blog_sitemap_path(:format => :xml) if record.is_news && Spud::Blog.config.news_enabled expire_page news_path expire_page news_path(:format => :rss) expire_page news_post_path(record.url_name) elsif Spud::Blog.config.blog_enabled expire_page blog_path expire_page blog_path(:format => :rss) expire_page blog_post_path(record.url_name) end end expire_page spud_sitemap_path(:format => :xml) end end
Version data entries
5 entries across 5 versions & 1 rubygems