Creates a pool of stores. Each thread gets its own store.
@example Add `Moneta::Pool` to proxy stack
Moneta.build do use(:Pool) do # Every thread gets its own instance adapter :MemcachedNative end end
@api public
@param [Moneta store] adapter The underlying store @param [Hash] options @option options [String] :mutex (::Mutex.new) Mutex object
# File lib/moneta/pool.rb, line 20 def initialize(options = {}, &block) super(nil) @mutex = options[:mutex] || ::Mutex.new @id = "Moneta::Pool(#{object_id})" @builder = Builder.new(&block) @pool, @all = [], [] end
# File lib/moneta/pool.rb, line 38 def adapter Thread.current[@id] end
Generated with the Darkfish Rdoc Generator 2.