def __init__(self, redis_uri=None, redis_tuple=None): self.__io_loop = IOLoop.instance() if redis_uri: host, port, db, self.__pwd = resolve_redis_url(redis_uri) self.__redis_tuple = host, port, db elif redis_tuple: assert 4 == len(redis_tuple) self.__redis_tuple = redis_tuple[:3] self.__pwd = redis_tuple[-1] self.__conn = None
def __init__(self, url, sync=True, host='localhost', port=6379, db=0, pwd=None): """ :param url: redis://localhost:6379/0?pwd=xx """ self.__is_sync = sync if url: #单个db实例 self.__redis_ob = SyncRedis(*resolve_redis_url(url)) if sync else AsyncRedis(redis_uri=url) else: if sync: self.__redis_ob = SyncRedis(host, port, db, pwd) else: self.__redis_ob = AsyncRedis(redis_tuple=(host, port, db, pwd))
def __init__(self, url, sync=True, host='localhost', port=6379, db=0, pwd=None): """ :param url: redis://localhost:6379/0?pwd=xx """ self.__is_sync = sync if url: #单个db实例 self.__redis_ob = SyncRedis( *resolve_redis_url(url)) if sync else AsyncRedis(redis_uri=url) else: if sync: self.__redis_ob = SyncRedis(host, port, db, pwd) else: self.__redis_ob = AsyncRedis(redis_tuple=(host, port, db, pwd))