From 05d4b9d2fdb0aceb9082303301ecaf77605288a0 Mon Sep 17 00:00:00 2001 From: Brian Durand Date: Mon, 1 Aug 2011 12:05:29 -0500 Subject: [PATCH] Pass options in ActiveSupport::Cache::CacheStore#read_multi through to the delete_entry call. --- activesupport/lib/active_support/cache.rb | 2 +- activesupport/test/caching_test.rb | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/activesupport/lib/active_support/cache.rb b/activesupport/lib/active_support/cache.rb index 2d2264e58a..95d936b32f 100644 --- a/activesupport/lib/active_support/cache.rb +++ b/activesupport/lib/active_support/cache.rb @@ -347,7 +347,7 @@ def read_multi(*names) entry = read_entry(key, options) if entry if entry.expired? - delete_entry(key) + delete_entry(key, options) else results[name] = entry.value end diff --git a/activesupport/test/caching_test.rb b/activesupport/test/caching_test.rb index dff3d6ef0d..6bb13ec9b8 100644 --- a/activesupport/test/caching_test.rb +++ b/activesupport/test/caching_test.rb @@ -199,6 +199,14 @@ def test_read_multi @cache.write('fud', 'biz') assert_equal({"foo" => "bar", "fu" => "baz"}, @cache.read_multi('foo', 'fu')) end + + def test_read_multi_with_expires + @cache.write('foo', 'bar', :expires_in => 0.001) + @cache.write('fu', 'baz') + @cache.write('fud', 'biz') + sleep(0.002) + assert_equal({"fu" => "baz"}, @cache.read_multi('foo', 'fu')) + end def test_read_and_write_compressed_small_data @cache.write('foo', 'bar', :compress => true) -- GitLab