Commit 17d8ab6c authored by Sean Bleier's avatar Sean Bleier
parents dc63e942 ab084443
......@@ -38,12 +38,15 @@ class CacheKey(object):
class CacheConnectionPool(object):
_connection_pool = None
def __init__(self):
self._connection_pools = {}
def get_connection_pool(self, host='127.0.0.1', port=6379, db=1,
password=None, parser_class=None,
unix_socket_path=None):
if self._connection_pool is None:
connection_identifier = (host, port, db, parser_class, unix_socket_path)
if not self._connection_pools.get(connection_identifier):
connection_class = (
unix_socket_path and UnixDomainSocketConnection or Connection
)
......@@ -60,8 +63,8 @@ class CacheConnectionPool(object):
})
else:
kwargs['path'] = unix_socket_path
self._connection_pool = redis.ConnectionPool(**kwargs)
return self._connection_pool
self._connection_pools[connection_identifier] = redis.ConnectionPool(**kwargs)
return self._connection_pools[connection_identifier]
pool = CacheConnectionPool()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment