diff options
author | Jeremy Kemper <jeremy@bitsweat.net> | 2008-02-01 07:07:56 +0000 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2008-02-01 07:07:56 +0000 |
commit | 601222f294e4665d90914229025cf699ae0fb85a (patch) | |
tree | f6a754c2570d109092b8705e96361a7c96a599c0 /activesupport | |
parent | e59de6046cf01852e1b16e7a6a39de94aefa7e72 (diff) | |
download | rails-601222f294e4665d90914229025cf699ae0fb85a.tar.gz rails-601222f294e4665d90914229025cf699ae0fb85a.tar.bz2 rails-601222f294e4665d90914229025cf699ae0fb85a.zip |
MemCacheStore#write uses add by default and set if :force => true
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8765 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activesupport')
-rw-r--r-- | activesupport/lib/active_support/cache/mem_cache_store.rb | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/activesupport/lib/active_support/cache/mem_cache_store.rb b/activesupport/lib/active_support/cache/mem_cache_store.rb index 5f38c4f1ce..12b450ed86 100644 --- a/activesupport/lib/active_support/cache/mem_cache_store.rb +++ b/activesupport/lib/active_support/cache/mem_cache_store.rb @@ -20,9 +20,12 @@ module ActiveSupport nil end - def write(key, value, options = nil) + # Set key = value if key isn't already set. Pass :force => true + # to unconditionally set key = value. + def write(key, value, options = {}) super - @data.set(key, value, expires_in(options), raw?(options)) + method = options[:force] ? :set : :add + @data.send(method, key, value, expires_in(options), raw?(options)) rescue MemCache::MemCacheError => e logger.error("MemCacheError (#{e}): #{e.message}") nil |