Method: Moneta::Defaults#increment

Defined in:
lib/moneta/mixins.rb

#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.

Parameters:

  • key (Object)
  • amount (Integer) (defaults to: 1)
  • options (Hash) (defaults to: {})

Options Hash (options):

  • :prefix (String)

    Prefix key (See Transformer)

  • Other (Object)

    options as defined by the adapters or middleware

Returns:

  • (Object)

    value from store

Raises:

  • (NotImplementedError)


130
131
132
# File 'lib/moneta/mixins.rb', line 130

def increment(key, amount = 1, options = {})
  raise NotImplementedError, 'increment is not supported'
end