A pool object

new Pool(options: Object)

Extends EventEmitter

Parameters
options (Object)
Name Description
options.acquire function The function that acquires a resource (e.g. opens a database connection) on behalf of the pool. Accepts a node-style callback, callback returning a promise or callback returning a value.
options.dispose function The function that disposes a resource (e.g. gracefully closes a database connection) on behalf of the pool. Accepts the resource to dispose of, which is the same object returned by the acquire function and a node-style callback, callback returning a promise or callback returning a value.
options.min number (default 0) Minimum number of resources to keep in pool at any given time.
options.max number (default 1) Maximum number of resources to create at any given time.
options.maxWaitingClients number (default 10) Maximum number of queued requests allowed, additional acquire calls will be callback with an error.
options.acquireTimeoutMs number (default 30000) Max milliseconds an acquire call will wait for a resource acquiring before timing out.
options.releaseTimeoutMs number (default 30000) Max milliseconds an release call will wait for a resource disposing before timing out.
options.fifo boolean (default false) If true the oldest resources will be first to be allocated. If false the most recently released resources will be the first to be allocated.
Instance Members
size
available
borrowed
acquire(cb?)
release(resource, cb?)
destroy(resource, cb?)
end(force, cb)