class DB::Pool(T)

Defined in:

db/pool.cr

Constructors

Instance Method Summary

Constructor Detail

def self.new(pool_options : Options = Options.new, &factory : -> T) #

[View source]
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) #

DEPRECATED Use #new with DB::Pool::Options instead


[View source]

Instance Method Detail

def checkout : T #

[View source]
def checkout(&block : T -> ) #

[View source]
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 and is_candidate == false


[View source]
def close : Nil #

close all resources in the pool


[View source]
def release(resource : T) : Nil #

[View source]
def stats #

Returns stats of the pool


[View source]