class ActiveSupport::Cache::MemCacheStore
def increment(name, amount = 1, options = nil)
Incrementing a non-numeric value, or a value written without
cache.increment("baz") # => 6
cache.write("baz", 5, raw: true)
To set a specific value, call #write passing raw: true:
cache.increment("bar", 100) # => 100
cache.increment("foo") # => 1
If the key is unset or has expired, it will be set to +amount+:
Returns the updated value.
Increment a cached integer value using the memcached incr atomic operator.
def increment(name, amount = 1, options = nil) options = merged_options(options) instrument(:increment, name, amount: amount) do rescue_error_with nil do @data.with { |c| c.incr(normalize_key(name, options), amount, options[:expires_in], amount) } end end end