instance method
clear
Ruby on Rails 6.0.6
Since v3.0.20Signature
clear(options = nil)
Deletes all items from the cache. In this case it deletes all the entries in the specified file store directory except for .keep or .gitkeep. Be careful which directory is specified in your config file when using FileStore because everything in that directory will be deleted.
Parameters
-
optionsopt = nil
Source
# File activesupport/lib/active_support/cache/file_store.rb, line 36
def clear(options = nil)
root_dirs = (Dir.children(cache_path) - GITKEEP_FILES)
FileUtils.rm_r(root_dirs.collect { |f| File.join(cache_path, f) })
rescue Errno::ENOENT, Errno::ENOTEMPTY
end
Defined in activesupport/lib/active_support/cache/file_store.rb line 36
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveSupport::Cache::FileStore