Method: Sequel::ConnectionPool#initialize
- Defined in:
- lib/sequel/connection_pool.rb
#initialize(db, opts = OPTS) ⇒ ConnectionPool
Instantiates a connection pool with the given options. The block is called with a single symbol (specifying the server/shard to use) every time a new connection is needed. The following options are respected for all connection pools:
- :after_connect
-
A callable object called after each new connection is made, with the connection object (and server argument if the callable accepts 2 arguments), useful for customizations that you want to apply to all connections.
- :preconnect
-
Automatically create the maximum number of connections, so that they don’t need to be created as needed. This is useful when connecting takes a long time and you want to avoid possible latency during runtime.
80 81 82 83 |
# File 'lib/sequel/connection_pool.rb', line 80 def initialize(db, opts=OPTS) @db = db @after_connect = opts[:after_connect] end |