Module | Cms::Caching |
In: |
lib/cms/caching.rb
|
# File lib/cms/caching.rb, line 3 3: def caching_enabled? 4: ActionController::Base.perform_caching 5: end
# File lib/cms/caching.rb, line 6 6: def flush_cache 7: #Hmmm...this is kinda scary. What if page cache directory is 8: #set to the the default, which is /public? 9: #So we are going to check that the directory is not called "public" 10: if File.exists?(ActionController::Base.page_cache_directory) && 11: File.basename(ActionController::Base.page_cache_directory) != "public" 12: FileUtils.rm_rf Dir.glob("#{ActionController::Base.page_cache_directory}/*") 13: Rails.logger.info "Cache Flushed" 14: end 15: end