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.
TODO reap connection of dead coroutines that didn't checkin (or died before)
Defined in:
connection.crConstructors
Instance Method Summary
-
#active?
Returns true if a connection was checkout for the current Fiber.
-
#connection
Returns the already checkout connection or checkout a connection then attaches it to the current Fiber.
-
#connection(&)
Yields a connection.
-
#release
Releases the checkout connection for the current Fiber (if any).
Instance methods inherited from class Pool(T)
capacity : Int32
capacity,
checkin(connection : T) : Nil
checkin,
checkout : T
checkout,
pending : Int32
pending,
size : Int32
size,
start_all
start_all,
timeout : Time::Span
timeout
Constructor methods inherited from class Pool(T)
new(capacity : Int32 = 5, timeout : Time::Span = 5.seconds, &block : -> T)
new
Constructor Detail
Instance Method Detail
Returns the already checkout connection or checkout a connection then attaches it to the current Fiber.
Yields a connection.
If a connection was already checkout for the curent Fiber, it will be yielded. Otherwise a connection will be checkout and tied to the current Fiber, passed to the block and eventually checkin.