aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support
diff options
context:
space:
mode:
authorRafael Mendonça França <rafaelmfranca@gmail.com>2014-06-27 18:21:30 -0300
committerRafael Mendonça França <rafaelmfranca@gmail.com>2014-06-27 18:24:01 -0300
commit3c19402fc3ba31c38df386ac328c3bccc717c9c3 (patch)
tree7de761ce560a834c8f4cbcab8a6aac70ab3f91b4 /activesupport/lib/active_support
parentebdedaec32957d5dd81b15e0cf1b60d3f5ccbcb1 (diff)
parentacee114ba00f67e485355b0eb3d7cb26bf283d6f (diff)
downloadrails-3c19402fc3ba31c38df386ac328c3bccc717c9c3.tar.gz
rails-3c19402fc3ba31c38df386ac328c3bccc717c9c3.tar.bz2
rails-3c19402fc3ba31c38df386ac328c3bccc717c9c3.zip
Merge pull request #15943 from wagenet/cache-instrumentation
Always instrument ActiveSupport::Cache
Diffstat (limited to 'activesupport/lib/active_support')
-rw-r--r--activesupport/lib/active_support/cache.rb21
1 files changed, 10 insertions, 11 deletions
diff --git a/activesupport/lib/active_support/cache.rb b/activesupport/lib/active_support/cache.rb
index a627fa8651..a3f672d4cc 100644
--- a/activesupport/lib/active_support/cache.rb
+++ b/activesupport/lib/active_support/cache.rb
@@ -8,6 +8,7 @@ require 'active_support/core_ext/numeric/bytes'
require 'active_support/core_ext/numeric/time'
require 'active_support/core_ext/object/to_param'
require 'active_support/core_ext/string/inflections'
+require 'active_support/deprecation'
module ActiveSupport
# See ActiveSupport::Cache::Store for documentation.
@@ -178,14 +179,16 @@ module ActiveSupport
@silence = previous_silence
end
- # Set to +true+ if cache stores should be instrumented.
- # Default is +false+.
+ # :deprecated:
def self.instrument=(boolean)
- Thread.current[:instrument_cache_store] = boolean
+ ActiveSupport::Deprecation.warn "ActiveSupport::Cache.instrument= is deprecated and will be removed in Rails 5. Instrumentation is now always on so you can safely stop using it."
+ true
end
+ # :deprecated:
def self.instrument
- Thread.current[:instrument_cache_store] || false
+ ActiveSupport::Deprecation.warn "ActiveSupport::Cache.instrument is deprecated and will be removed in Rails 5. Instrumentation is now always on so you can safely stop using it."
+ true
end
# Fetches data from the cache, using the given key. If there is data in
@@ -539,13 +542,9 @@ module ActiveSupport
def instrument(operation, key, options = nil)
log(operation, key, options)
- if self.class.instrument
- payload = { :key => key }
- payload.merge!(options) if options.is_a?(Hash)
- ActiveSupport::Notifications.instrument("cache_#{operation}.active_support", payload){ yield(payload) }
- else
- yield(nil)
- end
+ payload = { :key => key }
+ payload.merge!(options) if options.is_a?(Hash)
+ ActiveSupport::Notifications.instrument("cache_#{operation}.active_support", payload){ yield(payload) }
end
def log(operation, key, options = nil)