Skip to main content

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.

Release files for connection_pool 0.0.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for connection_pool 0.0.3
File Size Uploaded
connection_pool-0.0.3.tar.gz 3.8 kB Details

Release files / connection_pool-0.0.3.tar.gz

Download URL connection_pool-0.0.3.tar.gz
Size 3.8 kB
Tags Source
SHA-256 checksum
How to use checksums
bf429e7aef65921c69b4ed48f3d48d3eac1383b05d2df91884705842d974d0dc
BLAKE2b-256 checksum
How to use checksums
bddfc9b4e25dce00f6349fd28aadba7b6c3f7431cc8bd4308a158fbe57b6a22e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via Python-urllib/2.7

Release history Release notifications | RSS feed

This release

0.0.3 This release

1 release file

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page