Class: Redcord::ConnectionPool
- Inherits:
-
Object
- Object
- Redcord::ConnectionPool
- Defined in:
- lib/redcord/connection_pool.rb
Instance Method Summary collapse
-
#initialize(pool_size:, timeout:, **client_options) ⇒ ConnectionPool
constructor
A new instance of ConnectionPool.
- #method_missing(method_name, *args, &blk) ⇒ Object
Constructor Details
#initialize(pool_size:, timeout:, **client_options) ⇒ ConnectionPool
Returns a new instance of ConnectionPool.
6 7 8 9 10 11 |
# File 'lib/redcord/connection_pool.rb', line 6 def initialize(pool_size:, timeout:, **) @connection_pool = ::ConnectionPool.new(size: pool_size, timeout: timeout) do # Construct a new client every time the block gets called Redcord::Redis.new(**, logger: Redcord::Logger.proxy) end end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method_name, *args, &blk) ⇒ Object
23 24 25 26 27 |
# File 'lib/redcord/connection_pool.rb', line 23 def method_missing(method_name, *args, &blk) @connection_pool.with do |redis| redis.send(method_name, *args, &blk) end end |