class ActiveSupport::Cache::MemoryStore

def decrement(name, amount = 1, **options)


cache.decrement("baz") # => 4
cache.write("baz", 5)

To set a specific value, call #write:

cache.decrement("foo") # => -1

If the key is unset or has expired, it will be set to +-amount+.

Decrement a cached integer value. Returns the updated value.
def decrement(name, amount = 1, **options)
  instrument(:decrement, name, amount: amount) do
    modify_value(name, -amount, **options)
  end
end