Module Moneta::Defaults
In: lib/moneta/mixins.rb

Simple interface to key/value stores with Hash-like interface. @api public

Methods

[]   []=   close   create   decrement   features   fetch   included   increment   key?   supports?  

Included Modules

OptionSupport

Classes and Modules

Module Moneta::Defaults::ClassMethods

Public Class methods

Public Instance methods

Fetch value with key. Return nil if the key doesn‘t exist

@param [Object] key @return [Object] value @api public

Store value with key

@param [Object] key @param [Object] value @return value @api public

Explicitly close the store @return nil @api public

Atomically sets a key to value if it‘s not set.

@note Not every Moneta store implements this method,

      a NotImplementedError is raised if it is not supported.

@param [Object] key @param [Object] value @param [Hash] options @option options [Integer] :expires Update expiration time (See {Expires}) @option options [Boolean] :raw Raw access without value transformation (See {Transformer}) @option options [String] :prefix Prefix key (See {Transformer}) @return [Boolean] key was set @api public

Atomically decrement integer value with key

This is just syntactic sugar for calling increment with a negative value.

This method also accepts negative amounts.

@param [Object] key @param [Integer] amount @param [Hash] options @option options [String] :prefix Prefix key (See {Transformer}) @option options Other options as defined by the adapters or middleware @return [Object] value from store @api public

Returns features list

@return [Array<Symbol>] list of features

Fetch a value with a key

@overload fetch(key, options = {}, &block)

  retrieve a key. if the key is not available, execute the
  block and return its return value.
  @param [Object] key
  @param [Hash] options
  @option options [Integer] :expires Update expiration time (See {Expires})
  @option options [Boolean] :raw Raw access without value transformation (See {Transformer})
  @option options [String] :prefix Prefix key (See {Transformer})
  @return [Object] value from store

@overload fetch(key, default, options = {})

  retrieve a key. if the key is not available, return the default value.
  @param [Object] key
  @param [Object] default Default value
  @param [Hash] options
  @option options [Integer] :expires Update expiration time (See {Expires})
  @option options [Boolean] :raw Raw access without value transformation (See {Transformer})
  @option options [String] :prefix Prefix key (See {Transformer})
  @return [Object] value from store

@api public

Atomically increment integer value with key

This method also accepts negative amounts.

@note Not every Moneta store implements this method,

      a NotImplementedError is raised if it is not supported.

@param [Object] key @param [Integer] amount @param [Hash] options @option options [String] :prefix Prefix key (See {Transformer}) @option options Other options as defined by the adapters or middleware @return [Object] value from store @api public

Exists the value with key

@param [Object] key @param [Hash] options @option options [Integer] :expires Update expiration time (See {Expires}) @option options [String] :prefix Prefix key (See {Transformer}) @option options Other options as defined by the adapters or middleware @return [Boolean] @api public

Return true if adapter supports the given feature.

@return [Boolean]

[Validate]