def __init__(self, *args, **kwargs): """ Creates a new RedisBloom client. """ Redis.__init__(self, *args, **kwargs) # Set the module commands' callbacks MODULE_CALLBACKS = { self.BF_RESERVE: bool_ok, #self.BF_ADD: spaceHolder, #self.BF_MADD: spaceHolder, #self.BF_INSERT: spaceHolder, #self.BF_EXISTS: spaceHolder, #self.BF_MEXISTS: spaceHolder, #self.BF_SCANDUMP: spaceHolder, #self.BF_LOADCHUNK: spaceHolder, self.BF_INFO: BFInfo, self.CF_RESERVE: bool_ok, #self.CF_ADD: spaceHolder, #self.CF_ADDNX: spaceHolder, #self.CF_INSERT: spaceHolder, #self.CF_INSERTNX: spaceHolder, #self.CF_EXISTS: spaceHolder, #self.CF_DEL: spaceHolder, #self.CF_COUNT: spaceHolder, #self.CF_SCANDUMP: spaceHolder, #self.CF_LOADCHUNK: spaceHolder, self.CF_INFO: CFInfo, self.CMS_INITBYDIM: bool_ok, self.CMS_INITBYPROB: bool_ok, #self.CMS_INCRBY: spaceHolder, #self.CMS_QUERY: spaceHolder, self.CMS_MERGE: bool_ok, self.CMS_INFO: CMSInfo, self.TOPK_RESERVE: bool_ok, self.TOPK_ADD: parseToList, #self.TOPK_QUERY: spaceHolder, #self.TOPK_COUNT: spaceHolder, self.TOPK_LIST: parseToList, self.TOPK_INFO: TopKInfo, self.TDIGEST_CREATE: bool_ok, # self.TDIGEST_RESET: bool_ok, # self.TDIGEST_ADD: spaceHolder, # self.TDIGEST_MERGE: spaceHolder, # self.TDIGEST_CDF: spaceHolder, # self.TDIGEST_QUANTILE: spaceHolder, # self.TDIGEST_MIN: spaceHolder, # self.TDIGEST_MAX: spaceHolder, self.TDIGEST_INFO: TDigestInfo, } for k, v in six.iteritems(MODULE_CALLBACKS): self.set_response_callback(k, v)
def __init__(self, addr, db=0): if not addr: raise ValueError('Invalid redis address') if addr.startswith('unix://'): cargs = {'unix_socket_path':addr.replace('unix://', '')} elif addr.startswith('tcp://'): h = addr.replace('tcp://', '').split(':') cargs = {'host': h[0]} if len(h) == 2: cargs['port'] = int(h[1]) else: raise ValueError('Invalid redis address') Redis.__init__(self, **cargs)
def __init__(self, addr): if not addr: raise ValueError('Invalid redis address') if addr.startswith('unix://'): cargs = {'unix_socket_path':addr.replace('unix://', '')} elif addr.startswith('tcp://'): h = addr.replace('tcp://', '').split(':') cargs = {'host': h[0]} if len(h) == 2: cargs['port'] = int(h[1]) else: raise ValueError('Invalid redis address') Redis.__init__(self, **cargs)
def __init__(self, *args, **kwargs): self.encoding = 'utf-8' Redis.__init__(self, *args, **kwargs)