diff options
author | Joshua Peek <josh@joshpeek.com> | 2008-07-17 16:00:59 -0500 |
---|---|---|
committer | Joshua Peek <josh@joshpeek.com> | 2008-07-17 16:00:59 -0500 |
commit | 0eef4e554db9b1af47305f5a8c51c90c15ac6c04 (patch) | |
tree | c5c7c4bf8c794172df36a4a1dd24da28ec38fb62 | |
parent | 94cf6675d516a0196f0222694f26dcd4c29c49c6 (diff) | |
download | rails-0eef4e554db9b1af47305f5a8c51c90c15ac6c04.tar.gz rails-0eef4e554db9b1af47305f5a8c51c90c15ac6c04.tar.bz2 rails-0eef4e554db9b1af47305f5a8c51c90c15ac6c04.zip |
Allow ActiveSupport::Cache logger to be silenced
-rw-r--r-- | activesupport/lib/active_support/cache.rb | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/activesupport/lib/active_support/cache.rb b/activesupport/lib/active_support/cache.rb index 57c6a6331d..5a064f8bea 100644 --- a/activesupport/lib/active_support/cache.rb +++ b/activesupport/lib/active_support/cache.rb @@ -36,7 +36,6 @@ module ActiveSupport expanded_cache_key end - class Store cattr_accessor :logger @@ -44,6 +43,11 @@ module ActiveSupport extend ThreadSafety end + def silence! + @silence = true + self + end + # Pass <tt>:force => true</tt> to force a cache miss. def fetch(key, options = {}) @logger_off = true @@ -108,7 +112,7 @@ module ActiveSupport private def log(operation, key, options) - logger.debug("Cache #{operation}: #{key}#{options ? " (#{options.inspect})" : ""}") if logger && !@logger_off + logger.debug("Cache #{operation}: #{key}#{options ? " (#{options.inspect})" : ""}") if logger && !@silence && !@logger_off end end |