Module: ActionControllerCachingExtensions::ClassMethods

Defined in:
lib/extensions/action_controller_caching_extensions.rb

Instance Method Summary collapse

Instance Method Details

#expire_page(path) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
# File 'lib/extensions/action_controller_caching_extensions.rb', line 5

def expire_page(path)
  return unless perform_caching
  
  path = Pathname.new(page_cache_path(path)).relative_path_from(Pathname.new(Rails.root))
  Dir.chdir Rails.root
  
  instrument_page_cache :expire_page, path do
    Dir.glob(path, File::FNM_CASEFOLD).each { |f| File.delete(f) }
    Dir.glob(path + '.gz', File::FNM_CASEFOLD).each { |f| File.delete(f) }
  end
end