From b22ee64b5b30c6d5039c292235e10b24b1057f6d Mon Sep 17 00:00:00 2001 From: Takumasa Ochi Date: Sun, 19 Nov 2017 03:50:59 +0900 Subject: MemCacheStore: Support expiring counters Support `expires_in` in `ActiveSupport::Cache::MemCacheStore#increment` and `#decrement`. Closes #30716. --- activesupport/lib/active_support/cache/mem_cache_store.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'activesupport/lib/active_support/cache') diff --git a/activesupport/lib/active_support/cache/mem_cache_store.rb b/activesupport/lib/active_support/cache/mem_cache_store.rb index 9242a334f2..50f072388d 100644 --- a/activesupport/lib/active_support/cache/mem_cache_store.rb +++ b/activesupport/lib/active_support/cache/mem_cache_store.rb @@ -122,7 +122,7 @@ module ActiveSupport options = merged_options(options) instrument(:increment, name, amount: amount) do rescue_error_with nil do - @data.incr(normalize_key(name, options), amount) + @data.incr(normalize_key(name, options), amount, options[:expires_in]) end end end @@ -135,7 +135,7 @@ module ActiveSupport options = merged_options(options) instrument(:decrement, name, amount: amount) do rescue_error_with nil do - @data.decr(normalize_key(name, options), amount) + @data.decr(normalize_key(name, options), amount, options[:expires_in]) end end end -- cgit v1.2.3