def __init__(self, host=None, port=6379, db=0, password=None, sentinels=None, service_name=None, decode_responses=True, socket_timeout=None, log=None, *args, **kwargs): if sentinels: sentinel = Sentinel(sentinels=sentinels) master = sentinel.discover_master(service_name=service_name) host, port = master self.server = { 'host': host, 'port': port, 'db': db, 'password': password, 'decode_responses': decode_responses, 'socket_timeout': socket_timeout } self.log = log if log else SimpleLog() self.pool = ConnectionPool(*args, **self.server, **kwargs) Redis.__init__(self, connection_pool=self.pool) # Redis.__init__(self, *args, **self.server, **kwargs) self.cache_result = {}
def __init__(self, key_prefix=None, error_sleep=1000, host='localhost', port=6379, db=0, password=None, socket_connect_timeout=1): self.key_prefix = key_prefix if key_prefix is not None: Redis.__init__(self, host, port, db, password=password, socket_connect_timeout=socket_connect_timeout) self.error_num = 0 self.error_sleep = error_sleep
def __init__(self, postfix='backtest'): Redis.__init__(self, host='redis', port=6379, db=0, charset="utf-8", decode_responses=True) pdebug5("Cache Pointing to: " + postfix) self.hash_postfix = postfix
def __new__(cls, db, *args, **kwargs): redis_conf = current_app.config["REDIS_CONF"] if not cls.redis[db]: # 支持多线程 with cls._instance_lock: if not cls.redis[db]: o = Redis.__new__(cls, *args) # Redis.__init__(o, db=db, **cls.redis_conf) Redis.__init__(o, db=db, **redis_conf) cls.redis.insert(db, o) return cls.redis[db]
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.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_LOADDUMP : spaceHolder, self.CMS_INITBYDIM: bool_ok, self.CMS_INITBYPROB: bool_ok, self.CMS_INCRBY: bool_ok, #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, } for k, v in six.iteritems(MODULE_CALLBACKS): self.set_response_callback(k, v)
def __init__(self, *args, **kwargs): """ Creates a new RedisTimeSeries client. """ Redis.__init__(self, *args, **kwargs) # Set the module commands' callbacks MODULE_CALLBACKS = { self.CREATE_CMD : bool_ok, self.ADD_CMD : int_or_none, self.INCRBY_CMD : bool_ok, self.DECRBY_CMD : bool_ok, self.CREATERULE_CMD : bool_ok, self.DELETERULE_CMD : bool_ok, self.RANGE_CMD : parse_range, self.MRANGE_CMD : parse_m_range, self.GET_CMD : lambda x: (int(x[0]), float(x[1])), self.INFO_CMD : parse_info, } for k, v in six.iteritems(MODULE_CALLBACKS): self.set_response_callback(k, v)
def __init__(self, *args, **kwargs): """ Creates a new RedisTimeSeries client. """ Redis.__init__(self, *args, **kwargs) # Set the module commands' callbacks MODULE_CALLBACKS = { self.CREATE_CMD : bool_ok, self.ALTER_CMD : bool_ok, self.CREATERULE_CMD : bool_ok, self.DELETERULE_CMD : bool_ok, self.RANGE_CMD : parse_range, self.MRANGE_CMD : parse_m_range, self.GET_CMD : lambda x: (int(x[0]), float(x[1])), self.MGET_CMD : parse_m_get, self.INFO_CMD : TSInfo, self.QUERYINDEX_CMD : parseToList, } for k in MODULE_CALLBACKS: self.set_response_callback(k, MODULE_CALLBACKS[k])
def __init__(self, host, port, db, pwd): Redis.__init__(self, host=host, port=port, db=db, password=pwd)
def __init__(self, *args, **kwargs): _Redis.__init__(self, *args, **kwargs)
def __init__(self): Redis.__init__(self,host=Settings.Redis.Host,port=6379)
def __init__(self, db=0, env="local"): Redis.__init__(self, db=db, decode_responses=True, **get_env(env)) # 自动连接redis self.expiration_time = 0 # 设置过期时间,单位秒
def __init__(self): Redis.__init__(self,host="10.8.0.1",port=6379,password="******")
def __init__(self, **kwargs): Redis.__init__(self, **kwargs)
def __init__(self, *args, **kwargs): Redis.__init__(self, *args, **kwargs) self.mfp = MockFP() self.callbacks = []
def __init__(self, host, port, db, *args, **kwargs): Redis.__init__(self, host, port, db, *args, **kwargs) self._host = host self._port = port self._db = db
def __init__(self, *args, **kwargs): self.namespace = kwargs.pop('namespace') Redis.__init__(self, *args, **kwargs)
def __init__(self, *v, **kw): _Redis.__init__(self, *v, **kw)
def __init__(self, Settings, BoardCode): Redis.__init__(self, host=Settings["REDIS"], port=Settings["REDIS_PORT"], password=Settings["REDIS_PASSWORD"], db=BoardCode["dbid"])