Skip to content
Browse files

Support db param in order to select redis database

  • Loading branch information...
1 parent 0ff334b commit 8427fba75fa17762fd351780eb6c893069778167 @iuridiniz iuridiniz committed Jun 26, 2012
Showing with 2 additions and 1 deletion.
  1. +2 −1 beaker_extensions/redis_.py
View
3 beaker_extensions/redis_.py
@@ -15,10 +15,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)
+ self.db = params.pop('db', 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), connection_pool=self.connection_pool, **params)
+ self.db_conn = Redis(host=host, port=int(port), connection_pool=self.connection_pool, db=self.db, **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))))

0 comments on commit 8427fba

Please sign in to comment.
Something went wrong with that request. Please try again.