cache_information.rb
上传用户:netsea168
上传日期:2022-07-22
资源大小:4652k
文件大小:0k
源码类别:

Ajax

开发平台:

Others

  1. class CacheInformation < ActiveRecord::Base
  2.   validates_presence_of :path
  3.   validates_uniqueness_of :path
  4.   before_destroy :delete_path_in_page_cache_directory
  5.   def delete_path_in_page_cache_directory
  6.     if File.exist? path_in_page_cache_directory
  7.       FileUtils.rm(path_in_page_cache_directory)
  8.     else
  9.       Rails.logger.warn("path : #{path} no more exist")
  10.     end
  11.   end
  12.   def path_in_page_cache_directory
  13.     File.join(ActionController::Base.page_cache_directory, path)
  14.   end
  15. end