Method: Moneta::Adapters::Client#increment

Defined in:
lib/moneta/adapters/client.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



48
49
50
51
# File 'lib/moneta/adapters/client.rb', line 48

def increment(key, amount = 1, options = {})
  write(:increment, key, amount, options)
  read_msg
end