Method: Cms::Caching#flush_cache

Defined in:
lib/cms/caching.rb

#flush_cacheObject



6
7
8
9
10
11
12
13
14
15
# File 'lib/cms/caching.rb', line 6

def flush_cache
  #Hmmm...this is kinda scary.  What if page cache directory is
  #set to the the default, which is /public?
  #So we are going to check that the directory is not called "public"
  if File.exists?(ActionController::Base.page_cache_directory) && 
      File.basename(ActionController::Base.page_cache_directory) != "public"
    FileUtils.rm_rf Dir.glob("#{ActionController::Base.page_cache_directory}/*")
    Rails.logger.info "Cache Flushed"
  end
end