class DB::Pool(T)
- DB::Pool(T)
- Reference
- Object
Defined in:
db/pool.crConstructors
Instance Method Summary
- #checkout : T
-
#checkout_some(candidates : Enumerable(WeakRef(T))) : ::Tuple(T, Bool)
-
#close : Nil
close all resources in the pool
- #release(resource : T) : Nil
-
#retry(&block)
:nodoc: Will retry the block if a
ConnectionLost
exception is thrown.
Constructor Detail
def self.new(initial_pool_size = 1, max_pool_size = 0, max_idle_pool_size = 1, checkout_timeout = 5.0, retry_attempts = 1, retry_delay = 0.2, &factory : -> T)
#
Instance Method Detail
def checkout_some(candidates : Enumerable(WeakRef(T))) : ::Tuple(T, Bool)
#
selected, is_candidate = pool.checkout_some(candidates)
selected
be a resource from the candidates
list and is_candidate
== true
or selected
will be a new resource adn is_candidate
== false
def retry(&block)
#
:nodoc:
Will retry the block if a ConnectionLost
exception is thrown.
It will try to reuse all of the available connection right away,
but if a new connection is needed there is a retry_delay
seconds delay.