Class: Moneta::Lock

Inherits:
Wrapper show all
Defined in:
lib/moneta/lock.rb

Overview

Locks the underlying stores with a Mutex

Instance Attribute Summary

Attributes inherited from Proxy

#adapter

Instance Method Summary collapse

Methods inherited from Wrapper

#clear, #close, #config, #create, #delete, #each_key, #features, #fetch_values, #increment, #key?, #load, #merge!, #slice, #store, #values_at

Methods inherited from Proxy

#clear, #close, #config, #create, #delete, #each_key, #features, features_mask, #fetch_values, #increment, #key?, #load, #merge!, not_supports, #slice, #store, #values_at

Methods included from Config

#config, included

Methods included from Defaults

#[], #[]=, #close, #create, #decrement, #each_key, #features, #fetch, #fetch_values, included, #increment, #key?, #merge!, #slice, #supports?, #update, #values_at

Methods included from OptionSupport

#expires, #prefix, #raw, #with

Constructor Details

#initialize(adapter, options = {}) ⇒ Lock

Returns a new instance of Lock.

Parameters:

  • adapter (Moneta store)

    The underlying store

  • options (Hash) (defaults to: {})

Options Hash (options):

  • :mutex (String) — default: ::Mutex.new

    Mutex object



10
11
12
13
# File 'lib/moneta/lock.rb', line 10

def initialize(adapter, options = {})
  super
  @lock = options[:mutex] || ::Mutex.new
end