class RuboCop::ResultCache

def self.cleanup(config_store, verbose, cache_root = nil)

there's parallel execution and the cache is shared.
that some other RuboCop process was just about to read the file, when
cleaning should be done relatively seldom, since there is a slight risk
files in the cache are removed. The reason for removing so much is that
threshold MaxFilesInCache has been exceeded, the oldest 50% of all the
Remove old files so that the cache doesn't grow too big. When the
def self.cleanup(config_store, verbose, cache_root = nil)
  return if inhibit_cleanup # OPTIMIZE: For faster testing
  cache_root ||= cache_root(config_store)
  return unless File.exist?(cache_root)
  files, dirs = Find.find(cache_root).partition { |path| File.file?(path) }
  return unless requires_file_removal?(files.length, config_store)
  remove_oldest_files(files, dirs, cache_root, verbose)
end