method

decrement

rails latest stable - Class: ActiveSupport::Cache::MemoryStore
decrement(name, amount = 1, options = nil)
public

Decrement a cached integer value. Returns the updated value.

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

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

To set a specific value, call #write:

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