# File lib/moneta/adapters/memcached/native.rb, line 60 def increment(key, amount = 1, options = {}) result = if amount >= 0 @backend.increment(key, amount) else @backend.decrement(key, -amount) end # HACK: Throw error if applied to invalid value # see https://github.com/evan/memcached/issues/110 Utils.to_int((@backend.get(key, false) rescue nil)) if result == 0 result rescue ::Memcached::NotFound => ex retry unless create(key, amount.to_s, options) amount end