def __init__(self, *a, **kw): Redis.__init__(self, *a, **kw) version = [ int(part) for part in self.info()['redis_version'].split('.') ] self._have_pttl = version >= [2, 6] self._types = set(['string', 'list', 'set', 'zset', 'hash'])
def __init__(self, encoder=None, decoder=None, *args, **kwargs): """ Creates a new ReJSON client. ``encoder`` should be an instance of a ``json.JSONEncoder`` class ``decoder`` should be an instance of a ``json.JSONDecoder`` class """ self.setEncoder(encoder) self.setDecoder(decoder) StrictRedis.__init__(self, *args, **kwargs) # Set the module commands' callbacks MODULE_CALLBACKS = { 'JSON.DEL': long, 'JSON.GET': self._decode, 'JSON.MGET': bulk_of_jsons(self._decode), 'JSON.SET': lambda r: r and nativestr(r) == 'OK', 'JSON.NUMINCRBY': self._decode, 'JSON.NUMMULTBY': self._decode, 'JSON.STRAPPEND': long, 'JSON.STRLEN': long, 'JSON.ARRAPPEND': long, 'JSON.ARRINDEX': long, 'JSON.ARRINSERT': long, 'JSON.ARRLEN': long, 'JSON.ARRPOP': self._decode, 'JSON.ARRTRIM': long, 'JSON.OBJLEN': long, } for k, v in six.iteritems(MODULE_CALLBACKS): self.set_response_callback(k, v)
def __init__(self, *args, **kwargs): self.server_id = str(kwargs.pop('server_id')) LOG.info('GLockRedis client start with server_id %s' % self.server_id) self.heart_beat_over_time = kwargs.pop('heart_beat_over_time') self.heart_beat_over_time_max_count = kwargs.pop('heart_beat_over_time_max_count') self.reserve_time = kwargs.pop('reserve_time') StrictRedis.__init__(self, *args, **kwargs) self.running = False self.garbage_keys = dict()
def __init__(self, cfg_fn): self.__read_configure(cfg_fn) StrictRedis.__init__(self, host=self._redis_host, port=self._redis_port, password=self._redis_passwd, db=self._redis_db) self.redis_client = StrictRedis(host=self._redis_host, port=self._redis_port, password=self._redis_passwd, db=self._redis_db)
def __init__(self, cluster_address, port, password, cluster_credentials, **kwargs): self.port, self.node_id = port.split(":") self.password = password self.cluster_username, self.cluster_password = cluster_credentials.split( ":") self.host = self._get_node_address(cluster_address) StrictRedis.__init__(self, host=self.host, port=self.port, password=self.password, decode_responses=False, **kwargs)
def __init__(self, host, port, password, shards_port, cluster_address, cluster_credentials, **kwargs): self.host = host self.port = port self.shard_list = [ Shard(cluster_address=cluster_address, port=port, password=password, cluster_credentials=cluster_credentials) for port in shards_port ] StrictRedis.__init__(self, host=self.host, port=self.port, decode_responses=False, **kwargs)
def __init__(self, value_converter=None, *args, **kwargs): self._cache = {} self._dirty_keys = set() self.converter = value_converter StrictRedis.__init__(self, *args, **kwargs)
def __init__(self, *args, **kwargs): self._cache = {} self._dirty_keys = set() StrictRedis.__init__(self, *args, **kwargs)