def connect(self):
''' Open Connection to Redis '''
if "password" not in self.config['datastore']['plugins']['redis'].keys():
password = None
else:
password = self.config['datastore']['plugins']['redis']['password']
try:
self.dbc = redis.Redis(
host=self.config['datastore']['plugins']['redis']['host'],
port=self.config['datastore']['plugins']['redis']['port'],
password=None,
db=self.config['datastore']['plugins']['redis']['db'])
except Exception as e:
raise Exception("Failed to connect to Redis: {0}".format(e.message))
self.initialize_db()
return True
评论列表
文章目录