class ActiveSupport::Cache::FileStore

def cleanup(options = nil)

Preemptively iterates through all stored keys and removes the ones which have expired.
def cleanup(options = nil)
  options = merged_options(options)
  search_dir(cache_path) do |fname|
    entry = read_entry(fname, **options)
    delete_entry(fname, **options) if entry && entry.expired?
  end
end