Class: Believer::Connection::Pool
- Inherits:
-
Object
- Object
- Believer::Connection::Pool
- Includes:
- Singleton
- Defined in:
- lib/believer/connection.rb
Instance Method Summary collapse
-
#connection(environment) ⇒ Object
Retrieve a connection from the pool.
Instance Method Details
#connection(environment) ⇒ Object
Retrieve a connection from the pool
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/believer/connection.rb', line 27 def connection(environment) unless @connection_pool pool_config = environment.connection_pool_configuration if pool_config.nil? pool_config = { :size => 1, :timeout => 10 } end @connection_pool ||= ::ConnectionPool.new(pool_config) do environment.create_connection(:connect_to_keyspace => true) end end @connection_pool end |