-
Notifications
You must be signed in to change notification settings - Fork 16
API StaticPool
Thiago Delgado Pinto edited this page Dec 13, 2017
·
4 revisions
The StaticPool is a Pool implementation where the pools for a given connection URL are static. That is two constructors with the same URL will still use the same pool of connections.
new StaticPool( connection: string | ConnectionObject, poolSize: integer, driver?: DatabaseDriver )
Parameter | Type | Description |
---|---|---|
connection | string or ConnectionObject | Defines the connection parameters for all connections in the pool. |
poolSize | integer | Defines the number of connections in the pool. |
driver | DatabaseDriver | An optional parameter. Used to pass in a specific driver class. If this is specified, the driver name is ignored in the connection argument. |
Property | Type | Description |
---|---|---|
Available | integer | Returns the number of available connections in the pool. |
InUse | integer | Returns the number of connection in use from the pool. |
Count | integer | Returns the total number of connections n the pool |
Retrieves an available connection from the pool, or adds one if required.
getConnection() => PooledConnection
Type | Description |
---|---|
PooledConnection | The next available connection from the pool. If no connections are available, a new one is created. |
Closes the pool and forces all connections in the pool to close;
close() => Promise<boolean>
Type | Description |
---|---|
Promise<boolean> | A boolean promise that resolves when all the connections in the pool have been closed. |