Class: RedisMemo::ConnectionPool
- Inherits:
-
Object
- Object
- RedisMemo::ConnectionPool
- Defined in:
- lib/redis_memo/connection_pool.rb
Instance Method Summary collapse
-
#initialize(**options) ⇒ ConnectionPool
constructor
A new instance of ConnectionPool.
- #method_missing(method_name, *args, &blk) ⇒ Object
Constructor Details
#initialize(**options) ⇒ ConnectionPool
Returns a new instance of ConnectionPool.
7 8 9 10 11 12 |
# File 'lib/redis_memo/connection_pool.rb', line 7 def initialize(**) @connection_pool = ::ConnectionPool.new(**) do # Construct a new client every time the block gets called RedisMemo::Redis.new(RedisMemo::DefaultOptions.redis_config) 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/redis_memo/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 |