Module: CarrierWave::Uploader::Cache::ClassMethods

Defined in:
lib/carrierwave/uploader/cache.rb

Instance Method Summary collapse

Instance Method Details

#clean_cached_files!(seconds = 60*60*24) ⇒ Object

Removes cached files which are older than one day. You could call this method from a rake task to clean out old cached files.

You can call this method directly on the module like this:

CarrierWave.clean_cached_files!

Note

This only works as long as you haven’t done anything funky with your cache_dir. It’s recommended that you keep cache files in one place only.



54
55
56
# File 'lib/carrierwave/uploader/cache.rb', line 54

def clean_cached_files!(seconds=60*60*24)
  cache_storage.new(CarrierWave::Uploader::Base.new).clean_cache!(seconds)
end