Skip to content

Commit

Permalink
Merge pull request #4 from lambacck/master
Browse files Browse the repository at this point in the history
Allow a redis.ConnectionPool object to passed into the redis backend
  • Loading branch information
bbangert committed Mar 12, 2012
2 parents 9c33143 + 84d69cc commit 0ff334b
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion beaker_extensions/redis_.py
Expand Up @@ -14,10 +14,11 @@

class RedisManager(NoSqlManager):
def __init__(self, namespace, url=None, data_dir=None, lock_dir=None, **params):
self.connection_pool = params.pop('connection_pool', None)
NoSqlManager.__init__(self, namespace, url=url, data_dir=data_dir, lock_dir=lock_dir, **params)

def open_connection(self, host, port, **params):
self.db_conn = Redis(host=host, port=int(port), **params)
self.db_conn = Redis(host=host, port=int(port), connection_pool=self.connection_pool, **params)

def __contains__(self, key):
log.debug('%s contained in redis cache (as %s) : %s'%(key, self._format_key(key), self.db_conn.exists(self._format_key(key))))
Expand Down

0 comments on commit 0ff334b

Please sign in to comment.