Module: Blacksand::ExpirePages

Extended by:
ActiveSupport::Concern
Defined in:
lib/blacksand/expire_pages.rb

Instance Method Summary collapse

Instance Method Details

#expire_cache_pagesObject



10
11
12
13
14
15
16
17
18
19
# File 'lib/blacksand/expire_pages.rb', line 10

def expire_cache_pages
  if defined? Rails.application.routes.url_helpers.root_path
    expire_page Rails.application.routes.url_helpers.root_path
  end

  # TODO: 有点暴力, 可以扫描缓存文件夹,挨个删除
  Blacksand::Page.find_each do |p|
    expire_page Rails.application.routes.url_helpers.page_path(p)
  end
end