aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/cache.rb
diff options
context:
space:
mode:
authorKasper Timm Hansen <kaspth@gmail.com>2016-02-20 17:35:52 +0100
committerKasper Timm Hansen <kaspth@gmail.com>2016-02-20 17:35:52 +0100
commitc4a46fa781d39f1b4607cb1613a1c67fa044ce54 (patch)
tree54b03fef7180b5e540a719c974b539da8460bdef /activesupport/lib/active_support/cache.rb
parentb4558c10fb8f5379ffe23860c9ad1ee7a227de44 (diff)
downloadrails-c4a46fa781d39f1b4607cb1613a1c67fa044ce54.tar.gz
rails-c4a46fa781d39f1b4607cb1613a1c67fa044ce54.tar.bz2
rails-c4a46fa781d39f1b4607cb1613a1c67fa044ce54.zip
Revert "Instrument read_multi".
Reevaluating the log output generated from this instrumentation, we've found that it wasn't all that useful in practice. ``` Caches multi read: - views/david/2/4184ab71db6849621a4d8820fcd2c0ad - views/david/2/4184ab71db6849621a4d8820fcd2c0ad - views/david/3/4184ab71db6849621a4d8820fcd2c0ad - views/david/3/4184ab71db6849621a4d8820fcd2c0ad ``` If rendering many templates the output is inscrutable, and it's impossible to see how many cache misses there were. Revert ca6aba7f30 and implement a better way later.
Diffstat (limited to 'activesupport/lib/active_support/cache.rb')
-rw-r--r--activesupport/lib/active_support/cache.rb33
1 files changed, 10 insertions, 23 deletions
diff --git a/activesupport/lib/active_support/cache.rb b/activesupport/lib/active_support/cache.rb
index 610105f41c..1c63e8a93f 100644
--- a/activesupport/lib/active_support/cache.rb
+++ b/activesupport/lib/active_support/cache.rb
@@ -333,21 +333,19 @@ module ActiveSupport
options = names.extract_options!
options = merged_options(options)
- instrument_multi(:read, names, options) do |payload|
- results = {}
- names.each do |name|
- key = normalize_key(name, options)
- entry = read_entry(key, options)
- if entry
- if entry.expired?
- delete_entry(key, options)
- else
- results[name] = entry.value
- end
+ results = {}
+ names.each do |name|
+ key = normalize_key(name, options)
+ entry = read_entry(key, options)
+ if entry
+ if entry.expired?
+ delete_entry(key, options)
+ else
+ results[name] = entry.value
end
end
- results
end
+ results
end
# Fetches data from the cache, using the given keys. If there is data in
@@ -555,17 +553,6 @@ module ActiveSupport
ActiveSupport::Notifications.instrument("cache_#{operation}.active_support", payload){ yield(payload) }
end
- def instrument_multi(operation, keys, options = nil)
- log do
- formatted_keys = keys.map { |k| "- #{k}" }.join("\n")
- "Caches multi #{operation}:\n#{formatted_keys}#{options.blank? ? "" : " (#{options.inspect})"}"
- end
-
- payload = { key: keys }
- payload.merge!(options) if options.is_a?(Hash)
- ActiveSupport::Notifications.instrument("cache_#{operation}_multi.active_support", payload) { yield(payload) }
- end
-
def log
return unless logger && logger.debug? && !silence?
logger.debug(yield)