Metadata-Version: 2.1
Name: connection-pool
Version: 0.0.3
Summary: thread safe connection pool
Home-page: https://github.com/zhouyl/ConnectionPool
Author: zhouyl
Author-email: 81438567@qq.com
License: MIT
Classifier: Operating System :: OS Independent
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: Implementation
Classifier: Programming Language :: Python :: 2
Classifier: Programming Language :: Python :: 2.7
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.4
Classifier: Programming Language :: Python :: 3.5
Classifier: Programming Language :: Python :: 3.6
Classifier: Topic :: Software Development :: Libraries :: Python Modules

ConnectionPool
##############

Thread-safe connection pool for python

Install
=======

.. code-block:: bash

    $ pip install connection_pool


Examples
========

Create a pool
---------------

.. code-block:: python

    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.
