1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

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
This commit is contained in:
Jeremy Kemper 2008-02-01 07:07:56 +00:00
parent e59de6046c
commit 601222f294

View file

@ -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