Class: Mcache::Connection

Inherits:
Object
  • Object
show all
Defined in:
lib/mcache/connection.rb

Instance Method Summary collapse

Constructor Details

#initialize(host, size, timeout = 5, options = {}) ⇒ Connection

Returns a new instance of Connection.



5
6
7
8
9
# File 'lib/mcache/connection.rb', line 5

def initialize(host, size, timeout = 5, options = {})
  @pool = ConnectionPool.new(size: size, timeout: timeout) do
    Dalli::Client.new(host, options)
  end
end

Instance Method Details

#runObject



11
12
13
14
15
# File 'lib/mcache/connection.rb', line 11

def run
  @pool.with do |cn|
    yield(cn)
  end
end