Class BurstyPool (1.19.3)

  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

Name
Description
target_size
int

max pool size

labels
dict (str -> str) or None

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

Properties

labels

User-assigned labels for sesions created by the pool.

Returns
Type
Description
dict (str -> str)
labels assigned by the user

Methods

bind

  bind 
 ( 
 database 
 ) 
 

Associate the pool with a database.

Parameter
Name
Description
database
Database

database used by the pool: used to create sessions when needed.

clear

  clear 
 () 
 

Delete all sessions in the pool.

get

  get 
 () 
 

Check a session out from the pool.

Returns
Type
Description
an 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
Name
Description
session
Session

the session being returned.

session

  session 
 ( 
 ** 
 kwargs 
 ) 
 

Check out a session from the pool.

Returns
Type
Description
SessionCheckout
a checkout instance, to be used as a context manager for accessing the session and returning it to the pool.
Create a Mobile Website
View Site in Mobile | Classic
Share by: