Class: Mcache::Connection
- Inherits:
-
Object
- Object
- Mcache::Connection
- Defined in:
- lib/mcache/connection.rb
Instance Method Summary collapse
-
#initialize(host, size, timeout = 5, options = {}) ⇒ Connection
constructor
A new instance of Connection.
- #run ⇒ Object
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, = {}) @pool = ConnectionPool.new(size: size, timeout: timeout) do Dalli::Client.new(host, ) end end |
Instance Method Details
#run ⇒ Object
11 12 13 14 15 |
# File 'lib/mcache/connection.rb', line 11 def run @pool.with do |cn| yield(cn) end end |