Class: Squirm::Rails::ConnectionPool
- Inherits:
-
Object
- Object
- Squirm::Rails::ConnectionPool
- Defined in:
- lib/squirm/rails/connection_pool.rb
Instance Method Summary collapse
- #checkin(raw_connection) ⇒ Object
- #checkout ⇒ Object
-
#initialize ⇒ ConnectionPool
constructor
A new instance of ConnectionPool.
Constructor Details
#initialize ⇒ ConnectionPool
Returns a new instance of ConnectionPool.
5 6 7 8 |
# File 'lib/squirm/rails/connection_pool.rb', line 5 def initialize @pool = ActiveRecord::Base.connection_pool @map = {} end |
Instance Method Details
#checkin(raw_connection) ⇒ Object
17 18 19 |
# File 'lib/squirm/rails/connection_pool.rb', line 17 def checkin(raw_connection) @pool.checkin @map[raw_connection.object_id] end |
#checkout ⇒ Object
10 11 12 13 14 15 |
# File 'lib/squirm/rails/connection_pool.rb', line 10 def checkout conn = @pool.checkout raw_connection = conn.raw_connection @map[raw_connection.object_id] = conn raw_connection end |