Class BurstyPool (3.6.0)

BurstyPool(target_size=10, labels=None)

Concrete session pool implementation:

  • "Pings" existing sessions via session.exists before returning them.

  • Creates a new session, rather than blocking, when get is called on an empty pool.

  • Discards the returned session, rather than blocking, when put is called on a full pool.

Parameters

NameDescription
target_size int

max pool size

labels dict (str -> str) or None

(Optional) user-assigned labels for sessions created by the pool.

Methods

bind

bind(database)

Associate the pool with a database.

Parameter
NameDescription
database Database

database used by the pool to create sessions when needed.

clear

clear()

Delete all sessions in the pool.

get

get()

Check a session out from the pool.

Returns
TypeDescription
Sessionan existing session from the pool, or a newly-created session.

put

put(session)

Return a session to the pool.

Never blocks: if the pool is full, the returned session is discarded.

Parameter
NameDescription
session Session

the session being returned.