thread safe connection pool
Project description
Thread-safe connection pool for python
Examples
Create a pool
import memcache
from connection_pool import ConnectionPool
# via create function
def create_memcache_client():
return memcache.Client(['127.0.0.1:11211'])
pool = ConnectionPool(create=create_memcache_client,
max_size=10, max_usage=10000, idle=60, ttl=120)
# via lambda
pool = ConnectionPool(create=lambda: memcache.Client(['127.0.0.1:11211']),
max_size=10)
# via functools.partial
from functools import partial
pool = ConnectionPool(create=partial(memcache.Client, ['127.0.0.1:11211']),
max_size=10)
# using a connection
with pool.item() as memcache:
memcache.set('foo', 'bar')
License
he MIT License (MIT). Please see License File for more information.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
connection_pool-0.0.1.tar.gz
(1.5 kB
view hashes)
Built Distribution
Close
Hashes for connection_pool-0.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 42abeaf5f7e31b20d462ba2470ec75d2643238ad1bb3a651edd2250ff80db2ce |
|
MD5 | 0e2214de0adcf082a2e47d0c6c75b814 |
|
BLAKE2b-256 | 708f80468ace3f04dc0c5f7b2f04c2b4dbc6a54f2cbb38ce1037b997da67f7b9 |