class ConnectionPool(T)
- ConnectionPool(T)
- Pool(T)
- Reference
- Object
Overview
Sharing connections across coroutines.
Connections will be checkout from the pool and tied to the current fiber, until they are checkin, and thus be usable by another coroutine. Connections may also be manually checkout and checkin.
Defined in:
connection.crConstructors
Instance Method Summary
-
#active?
Returns true if a connection was checkout for the current coroutine.
-
#connection
Returns the already checkout connection or checkout a connection then attaches it to the current coroutine.
-
#connection(&)
Yields a connection.
-
#release
Releases the checkout connection for the current coroutine (if any).
Instance methods inherited from class Pool(T)
capacity
capacity,
checkin(connection : T)
checkin,
checkout : T
checkout,
pending
pending,
size
size,
start_all
start_all,
timeout
timeout
Constructor methods inherited from class Pool(T)
new(capacity : Int32 = 5, timeout : Float64 = 5.0, &block : -> T)
new
Constructor Detail
Instance Method Detail
Returns the already checkout connection or checkout a connection then attaches it to the current coroutine.
Yields a connection.
If a connection was already checkout for the curent coroutine, it will be yielded. Otherwise a connection will be checkout and tied to the current coroutine, passed to the block and eventually checkin.