class ActiveSupport::Cache::MemCacheStore
def decrement(name, amount = 1, options = nil)
Decrementing a non-numeric value, or a value written without
cache.decrement("baz") # => 4
cache.write("baz", 5, raw: true)
To set a specific value, call #write passing raw: true:
cache.decrement("foo") # => 0
does not support negative counters.
If the key is unset or has expired, it will be set to 0. Memcached
Returns the updated value.
Decrement a cached integer value using the memcached decr atomic operator.
def decrement(name, amount = 1, options = nil) options = merged_options(options) instrument(:decrement, name, amount: amount) do rescue_error_with nil do @data.with { |c| c.decr(normalize_key(name, options), amount, options[:expires_in], 0) } end end end