提交 1f0e4eba 编写于 作者: G George Claghorn 提交者: GitHub

Merge pull request #30789 from erichmachado/file-store-cache-cleanup-fix

Fixes ActiveSupport::Cache::FileStore#cleanup bug which prevented it from removing expired entries
......@@ -39,9 +39,8 @@ def clear(options = nil)
def cleanup(options = nil)
options = merged_options(options)
search_dir(cache_path) do |fname|
key = file_path_key(fname)
entry = read_entry(key, options)
delete_entry(key, options) if entry && entry.expired?
entry = read_entry(fname, options)
delete_entry(fname, options) if entry && entry.expired?
end
end
......
......@@ -118,6 +118,7 @@ def test_cleanup_removes_all_expired_entries
assert_not @cache.exist?("foo")
assert @cache.exist?("baz")
assert @cache.exist?("quux")
assert_equal 2, Dir.glob(File.join(cache_dir, "**")).size
end
end
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册