From 4ed775a770f305cab9b50f751928341b4501d8d7 Mon Sep 17 00:00:00 2001 From: Frederik Erbs Spang Thomsen Date: Tue, 27 Aug 2024 19:26:40 +0200 Subject: [PATCH] Instrument memory-store --- activesupport/lib/active_support/cache/memory_store.rb | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/activesupport/lib/active_support/cache/memory_store.rb b/activesupport/lib/active_support/cache/memory_store.rb index 2fe57190d8e7b..9d727258e0bef 100644 --- a/activesupport/lib/active_support/cache/memory_store.rb +++ b/activesupport/lib/active_support/cache/memory_store.rb @@ -147,7 +147,9 @@ def pruning? # cache.increment("baz") # => 6 # def increment(name, amount = 1, options = nil) - modify_value(name, amount, options) + instrument(:increment, name, amount: amount) do + modify_value(name, amount, options) + end end # Decrement a cached integer value. Returns the updated value. @@ -162,7 +164,9 @@ def increment(name, amount = 1, options = nil) # cache.decrement("baz") # => 4 # def decrement(name, amount = 1, options = nil) - modify_value(name, -amount, options) + instrument(:decrement, name, amount: amount) do + modify_value(name, -amount, options) + end end # Deletes cache entries if the cache key matches a given pattern.