aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/cache
diff options
context:
space:
mode:
authorTakumasa Ochi <aeroastro@users.noreply.github.com>2017-11-19 03:50:59 +0900
committerJeremy Daer <jeremydaer@gmail.com>2017-11-20 14:49:11 -0800
commitb22ee64b5b30c6d5039c292235e10b24b1057f6d (patch)
treebead1307088117c6c95269f261fdb75242f8ca54 /activesupport/lib/active_support/cache
parentae7593e7e842ec5efb8d58a7ce005ba55fd4c886 (diff)
downloadrails-b22ee64b5b30c6d5039c292235e10b24b1057f6d.tar.gz
rails-b22ee64b5b30c6d5039c292235e10b24b1057f6d.tar.bz2
rails-b22ee64b5b30c6d5039c292235e10b24b1057f6d.zip
MemCacheStore: Support expiring counters
Support `expires_in` in `ActiveSupport::Cache::MemCacheStore#increment` and `#decrement`. Closes #30716.
Diffstat (limited to 'activesupport/lib/active_support/cache')
-rw-r--r--activesupport/lib/active_support/cache/mem_cache_store.rb4
1 files changed, 2 insertions, 2 deletions
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