thread safe connection pool
Project description
Thread-safe connection pool for python
Install
$ pip install connection_pool
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
The 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.3.tar.gz
(3.8 kB
view details)
File details
Details for the file connection_pool-0.0.3.tar.gz
.
File metadata
- Download URL: connection_pool-0.0.3.tar.gz
- Upload date:
- Size: 3.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: Python-urllib/2.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | bf429e7aef65921c69b4ed48f3d48d3eac1383b05d2df91884705842d974d0dc |
|
MD5 | 59b670871eaf62f4b12c0b6a1f8c1eb8 |
|
BLAKE2b-256 | bddfc9b4e25dce00f6349fd28aadba7b6c3f7431cc8bd4308a158fbe57b6a22e |