Module: Moneta::IncrementSupport Private

This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.

Instance Method Summary collapse

Instance Method Details

#increment(key, amount = 1, options = {}) ⇒ Object

Note:

Not every Moneta store implements this method, a NotImplementedError is raised if it is not supported.

Atomically increment integer value with key

This method also accepts negative amounts.


158
159
160
161
162
# File 'lib/moneta/mixins.rb', line 158

def increment(key, amount = 1, options = {})
  value = convert_for_increment(load(key, options)) + amount
  store(key, value.to_s, options)
  value
end