class ActiveSupport::Cache::FileStore
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, it will be set to +-amount+.
Decrement a cached integer value. Returns the updated value.
def decrement(name, amount = 1, **options) options = merged_options(options) key = normalize_key(name, options) instrument(:decrement, key, amount: amount) do modify_value(name, -amount, options) end end