lib/carrierwave/storage/file.rb in carrierwave-1.3.4 vs lib/carrierwave/storage/file.rb in carrierwave-2.0.0.rc
- old
+ new
@@ -108,11 +108,11 @@
end
end
def clean_cache!(seconds)
Dir.glob(::File.expand_path(::File.join(uploader.cache_dir, '*'), CarrierWave.root)).each do |dir|
- # generate_cache_id returns key formated TIMEINT-PID-COUNTER-RND
- time = dir.scan(/(\d+)-\d+-\d+-\d+/).first.map(&:to_i)
+ # generate_cache_id returns key formated TIMEINT-PID(-COUNTER)-RND
+ time = dir.scan(/(\d+)-\d+-\d+(?:-\d+)?/).first.map(&:to_i)
time = Time.at(*time)
if time < (Time.now.utc - seconds)
FileUtils.rm_rf(dir)
end
end