Log an error to the console when the memcache server is raising

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8687 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
This commit is contained in:
David Heinemeier Hansson 2008-01-22 00:09:08 +00:00
parent 7701e6466d
commit 29938ba0f0
1 changed files with 6 additions and 3 deletions

View File

@ -15,21 +15,24 @@ module ActiveSupport
def read(key, options = nil)
super
@data.get(key, raw?(options))
rescue MemCache::MemCacheError
rescue MemCache::MemCacheError => e
logger.error("MemCacheError (#{e}): #{e.message}")
nil
end
def write(key, value, options = nil)
super
@data.set(key, value, expires_in(options), raw?(options))
rescue MemCache::MemCacheError
rescue MemCache::MemCacheError => e
logger.error("MemCacheError (#{e}): #{e.message}")
nil
end
def delete(key, options = nil)
super
@data.delete(key, expires_in(options))
rescue MemCache::MemCacheError
rescue MemCache::MemCacheError => e
logger.error("MemCacheError (#{e}): #{e.message}")
nil
end