class ActiveSupport::Cache::MemoryStore
def increment(name, amount = 1, **options)
cache.increment("baz") # => 6
cache.write("baz", 5)
To set a specific value, call #write:
cache.increment("bar", 100) # => 100
cache.increment("foo") # => 1
If the key is unset, it will be set to +amount+:
Increment a cached integer value. Returns the updated value.
def increment(name, amount = 1, **options) instrument(:increment, name, amount: amount) do modify_value(name, amount, **options) end end