Pool


Methods

f __init__(self, factory, dbapi_module, mincached=0, maxcached=None, maxshared=0, maxconnections=None, maxusage=None, blocking=False) ...

Create a connection pool.

factory:

a function that produces ready connections

dbapi_module:

the DB-API compliant module that connections come from

mincached:

initial number of idle connections in the pool (0 means no connections are made at startup)

maxcached:

maximum number of idle connections in the pool (None means unlimited pool size)

maxshared:

maximum number of shared connections (0 means all connections are dedicated). When this maximum number is reached, connections are shared if they have been requested as shareable. @@: Does this make sense?

maxconnections:

maximum number of connections generally allowed (None means an arbitrary number of connections)

blocking:

determines behavior when exceeding the maximum (false means report an error; otherwise block and wait until the number of connections decreases)

maxusage:

maximum number of reuses of a single connection (None means unlimited reuse) When this maximum usage number of the connection is reached, the connection is automatically reset (closed and reopened).

f connection(self, shareable=True) ...

Get a solid, cached connection from the pool.

If shareable is set and the underlying DB-API 2 allows it, then the connection may be shared with other threads.

f solid_connection(self) ...

Get a solid, unpooled solid DB-API 2 connection.

f unshare(self, conn) ...

Decrease the share of a connection in the shared cache.

f cache(self, conn) ...

Put a dedicated connection back into the idle cache.

f close(self) ...

Close all connections in the pool.

f __del__(self) ...

Pool is being garbage collected

See the source for more information.