Skip to content

Commit

Permalink
Merge pull request #10 from iuridiniz/didip
Browse files Browse the repository at this point in the history
Adds support to 'db' param in order to select redis database
  • Loading branch information
didip committed Jul 1, 2012
2 parents 48d2999 + b4b2c3a commit 656905c
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.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), **params)
self.db_conn = Redis(host=host, port=int(port), db=self.db, **params)

def __contains__(self, key):
return self.db_conn.exists(self._format_key(key))
Expand Down

0 comments on commit 656905c

Please sign in to comment.