aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/cache/mem_cache_store.rb
diff options
context:
space:
mode:
Diffstat (limited to 'activesupport/lib/active_support/cache/mem_cache_store.rb')
-rw-r--r--activesupport/lib/active_support/cache/mem_cache_store.rb18
1 files changed, 18 insertions, 0 deletions
diff --git a/activesupport/lib/active_support/cache/mem_cache_store.rb b/activesupport/lib/active_support/cache/mem_cache_store.rb
index ad220a9c2c..15e2df13b3 100644
--- a/activesupport/lib/active_support/cache/mem_cache_store.rb
+++ b/activesupport/lib/active_support/cache/mem_cache_store.rb
@@ -48,8 +48,26 @@ module ActiveSupport
rescue MemCache::MemCacheError => e
logger.error("MemCacheError (#{e}): #{e.message}")
false
+ end
+
+ def increment(key, amount = 1)
+ log("incrementing", key, amount)
+
+ response = @data.incr(key, amount)
+ response == Response::NOT_FOUND ? nil : response
+ rescue MemCache::MemCacheError
+ nil
end
+ def decrement(key, amount = 1)
+ log("decrement", key, amount)
+
+ response = data.decr(key, amount)
+ response == Response::NOT_FOUND ? nil : response
+ rescue MemCache::MemCacheError
+ nil
+ end
+
def delete_matched(matcher, options = nil)
super
raise "Not supported by Memcache"