From 2f7ce08b569813a2898b19f025b364d180769058 Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Fri, 1 Feb 2008 01:33:42 +0000 Subject: cache.fetch(key, :force => true) to force a cache miss git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8763 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- activesupport/lib/active_support/cache.rb | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'activesupport/lib/active_support/cache.rb') diff --git a/activesupport/lib/active_support/cache.rb b/activesupport/lib/active_support/cache.rb index 8252ada032..f9cfed43b8 100644 --- a/activesupport/lib/active_support/cache.rb +++ b/activesupport/lib/active_support/cache.rb @@ -47,9 +47,10 @@ module ActiveSupport self end - def fetch(key, options = nil) - @logger_off = true - if value = read(key, options) + # Pass :force => true to force a cache miss. + def fetch(key, options = {}) + @logger_off = true + if !options[:force] && value = read(key, options) @logger_off = false log("hit", key, options) value @@ -118,4 +119,4 @@ require 'active_support/cache/file_store' require 'active_support/cache/memory_store' require 'active_support/cache/drb_store' require 'active_support/cache/mem_cache_store' -require 'active_support/cache/compressed_mem_cache_store' \ No newline at end of file +require 'active_support/cache/compressed_mem_cache_store' -- cgit v1.2.3