Sha256: 993f7c19fea2467ff545fc234ab596b85b9c0eb458b368ef661d3625a53f5666

Contents?: true

Size: 775 Bytes

Versions: 7

Compression:

Stored size: 775 Bytes

Contents

ActionController::Base.class_eval do 
  def expire_pages(pages)
    pages.each { |page| expire_page(page.url) if page.url }
    CachedPage.expire_pages(pages)
  end

  def expire_site_page_cache
    # FIXME 
    # We can not simply kill the whole cache dir.
    # The following misses assets (like stylesheets) from themes though 
    # because they are not referenced as cached, yet. Do we need to expire
    # these assets at all though?
    expire_pages CachedPage.find_all_by_site_id(@site.id)

    # cache_dir = page_cache_directory
    # if cache_dir.gsub('/', '') =~ /public$/ 
    #   expire_pages CachedPage.find_all_by_site_id(@site.id)
    # else
    #   @site.cached_pages.delete_all
    #   Pathname.new(cache_dir).rmtree rescue Errno::ENOENT
    # end
  end
end

Version data entries

7 entries across 7 versions & 2 rubygems

Version Path
adva-0.1.4 lib/rails_ext/action_controller/page_caching.rb
adva-0.1.3 lib/rails_ext/action_controller/page_caching.rb
adva-0.1.2 lib/rails_ext/action_controller/page_caching.rb
adva-0.1.1 lib/rails_ext/action_controller/page_caching.rb
adva-0.1.0 lib/rails_ext/action_controller/page_caching.rb
adva_cms-0.0.1 lib/rails_ext/action_controller/page_caching.rb
adva-0.0.1 adva_cms/lib/rails_ext/action_controller/page_caching.rb