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, #delete, #increment, #key?, #load, #store

Methods inherited from Proxy

#clear, #close, #delete, #increment, #key?, #load, #store

Methods included from Defaults

#[], #[]=, #close, #decrement, #fetch, #increment, #key?

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