Class: Redic::Pool
- Inherits:
-
Object
- Object
- Redic::Pool
- Defined in:
- lib/redic/pool.rb
Constant Summary collapse
- VERSION =
"0.1.0"
Instance Attribute Summary collapse
-
#pool ⇒ Object
readonly
Returns the value of attribute pool.
Instance Method Summary collapse
- #call(*args) ⇒ Object
-
#initialize(url, options = {}) ⇒ Pool
constructor
A new instance of Pool.
- #with(&block) ⇒ Object
Constructor Details
#initialize(url, options = {}) ⇒ Pool
Returns a new instance of Pool.
9 10 11 |
# File 'lib/redic/pool.rb', line 9 def initialize(url, = {}) @pool = ConnectionPool.new(size: .fetch(:size, 10)) { Redic.new(url) } end |
Instance Attribute Details
#pool ⇒ Object (readonly)
Returns the value of attribute pool.
7 8 9 |
# File 'lib/redic/pool.rb', line 7 def pool @pool end |
Instance Method Details
#call(*args) ⇒ Object
13 14 15 16 17 |
# File 'lib/redic/pool.rb', line 13 def call(*args) @pool.with do |client| client.call(*args) end end |
#with(&block) ⇒ Object
19 20 21 |
# File 'lib/redic/pool.rb', line 19 def with(&block) @pool.with(&block) end |