Permalink
Browse files

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
  • Loading branch information...
jeremy committed Feb 1, 2008
1 parent be827f9 commit 2f7ce08b569813a2898b19f025b364d180769058
Showing with 7 additions and 4 deletions.
  1. +2 −0 activesupport/CHANGELOG
  2. +5 −4 activesupport/lib/active_support/cache.rb
View
@@ -1,5 +1,7 @@
*SVN*
+* cache.fetch(key, :force => true) to force a cache miss. [Jeremy Kemper]
+
* Support retrieving TimeZones with a Duration. TimeZone[-28800] == TimeZone[-480.minutes]. [rick]
* TimeWithZone#- added, so that #- can handle a Time or TimeWithZone argument correctly [Geoff Buesing]
@@ -47,9 +47,10 @@ def threadsafe!
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 @@ def delete_matched(matcher, options = nil) #:nodoc:
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'
+require 'active_support/cache/compressed_mem_cache_store'

0 comments on commit 2f7ce08

Please sign in to comment.