Sha256: 48e8a51ca0366b24522e57fdc3c81d35c3cde161a92b76c473f59451d1328ffc

Contents?: true

Size: 633 Bytes

Versions: 4

Compression:

Stored size: 633 Bytes

Contents

module Refinery
  class PageSweeper < ActionController::Caching::Sweeper
    observe Page

    def after_create(page)
      expire_cache
    end

    def after_update(page)
      expire_cache
    end

    def after_destroy(page)
      expire_cache
    end

  protected
    def expire_cache
      # TODO: Where does page_cache_directory come from??
      return unless page_cache_directory
      page_cache_directory = Pathname.new(page_cache_directory.to_s)

      # Delete the full Cache
      if (cache_root = page_cache_directory.join('refinery', 'cache', 'pages')).directory?
        cache_root.rmdir
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
refinerycms-pages-2.0.3 app/controllers/refinery/page_sweeper.rb
refinerycms-pages-2.0.2 app/controllers/refinery/page_sweeper.rb
refinerycms-pages-2.0.1 app/controllers/refinery/page_sweeper.rb
refinerycms-pages-2.0.0 app/controllers/refinery/page_sweeper.rb