# File lib/moneta/adapters/memcached/dalli.rb, line 52 def increment(key, amount = 1, options = {}) # FIXME: There is a Dalli bug, load(key) returns a wrong value after increment # therefore we set default = nil and create the counter manually # See https://github.com/mperham/dalli/issues/309 result = if amount >= 0 @backend.incr(key, amount, expires_value(options) || nil, nil) else @backend.decr(key, -amount, expires_value(options) || nil, nil) end if result result elsif create(key, amount.to_s, options) amount else increment(key, amount, options) end end