class ActiveSupport::Cache::RedisCacheStore
def increment(name, amount = 1, options = nil)
raw: true, will fail and return +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 Redis incrby atomic operator.
def increment(name, amount = 1, options = nil) instrument :increment, name, amount: amount do failsafe :increment do options = merged_options(options) key = normalize_key(name, options) change_counter(key, amount, options) end end end