diff options
author | Jeremy Kemper <jeremy@bitsweat.net> | 2008-02-01 01:33:42 +0000 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2008-02-01 01:33:42 +0000 |
commit | 2f7ce08b569813a2898b19f025b364d180769058 (patch) | |
tree | 3e0d57aa315f99da9ea6c496d2e13bbc5a2e69c0 | |
parent | be827f9348a703b3048cb7728d0de6d019279bd9 (diff) | |
download | rails-2f7ce08b569813a2898b19f025b364d180769058.tar.gz rails-2f7ce08b569813a2898b19f025b364d180769058.tar.bz2 rails-2f7ce08b569813a2898b19f025b364d180769058.zip |
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
-rw-r--r-- | activesupport/CHANGELOG | 2 | ||||
-rw-r--r-- | activesupport/lib/active_support/cache.rb | 9 |
2 files changed, 7 insertions, 4 deletions
diff --git a/activesupport/CHANGELOG b/activesupport/CHANGELOG index 8fb730dfd8..a39be78ca5 100644 --- a/activesupport/CHANGELOG +++ b/activesupport/CHANGELOG @@ -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] 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' |