Load the object from redis. Use the identifier (colon-separated
        composite keys or the primary key) or the redis_key.
16130
async def load(cls, db, identifier=None, redis_key=None):
        
        if not identifier and not redis_key:
            raise InvalidQuery('Must supply identifier or redis_key')
        if redis_key is None:
            redis_key = cls.make_key(identifier)
        if await db.exists(redis_key):
            data = await db.hgetall(redis_key)
            kwargs = {}
            for key_bin, value_bin in data.items():
                key, value = key_bin, value_bin
                column = getattr(cls, key, False)
                if not column or (column.field_type == str):
                    kwargs[key] = value
                elif column.field_type == datetime:
                    kwargs[key] = datetime.strptime(value, DATETIME_FORMAT)
                else:
                    kwargs[key] = column.field_type(value)
            kwargs['loading'] = True
            return cls(**kwargs)
        else:
            logger.debug("No Redis key found: {}".format(redis_key))
            return None
576207
def install_class_redis_object name, klass, opts
      raise ArgumentError, "Name is blank" if name.to_s.empty?
      name = name.to_s.to_sym
      opts = opts.nil? ? {} : opts.clone
      opts[:parent] = self unless opts.has_key?(:parent)
      # TODO: investigate using metaclass.redis_objects
      class_redis_objects_order << name
      class_redis_objects[name] = OpenStruct.new
      class_redis_objects[name].name = name
      class_redis_objects[name].klass = klass
      class_redis_objects[name].opts = opts 
      # An accessor method created in the metclass will
      # access the instance variables for this class. 
      metaclass.send :attr_reader, name
      metaclass.send :define_method, "#{name}=" do |v|
        send(name).replace v
      end
      metaclass.send :define_method, "#{name}?" do
        !send(name).empty?
      end
      redis_object = klass.new name, opts
      redis_object.freeze
      self.instance_variable_set("@#{name}", redis_object)
      class_redis_objects[name]
    end
498990
def from_url(url, db=None, **kwargs):
    
    from redis.client import Redis
    return Redis.from_url(url, db, **kwargs)
949778
def load(self, record_key, secret_key=''):
        
        '''
            
        '''
        
        title = '%s.load' % self.__class__.__name__
    
    # validate inputs
        input_fields = {
            'record_key': record_key,
            'secret_key': secret_key
        }
        for key, value in input_fields.items():
            if value:
                object_title = '%s(%s=%s)' % (title, key, str(value))
                self.fields.validate(value, '.%s' % key, object_title)
    
    # retrieve record data from s3
        record_data, record_metadata = self.s3.read_record(self.bucket_name, record_key)
    
    # validate secret key
        error_msg = '%s(secret_key="...") required to decrypt record "%s"' % (title, record_key)
        if 'encryption' in record_metadata['metadata'].keys():
            if record_metadata['metadata']['encryption'] == 'lab512':
                if not secret_key:
                    raise Exception(error_msg)
            else:
                self.s3.iam.printer('[WARNING]: %s uses unrecognized encryption method. Decryption skipped.' % record_key)
                secret_key = ''
                
    # decrypt (if necessary)
        if secret_key:
            from labpack.encryption import cryptolab
            record_data = cryptolab.decrypt(record_data, secret_key)
    
        return record_data
1025093
def _get_by_type(self, key, operation, create, type_, default, return_default=True):
        
        key = self._encode(key)
        if self.type(key) in [type_, b'none']:
            if create:
                return self.redis.setdefault(key, default)
            else:
                return self.redis.get(key, default if return_default else None)

        raise TypeError("{} requires a {}".format(operation, type_))
969294
function get(key) {
  return redis.get(key)
    .then(data => {
      if (isUri(key)) return data;
      return JSON.parse(data); // Parse non-uri data to match Postgres
    })
    .catch(() => postgres.get(key));
}
905525
def fetch(self):
        
        raw = yield gen.Task(self._redis_client.get, self._key)
        if raw:
            self.loads(base64.b64decode(raw))
            raise gen.Return(True)
        raise gen.Return(False)
1285924
def redis_key(cls, key):
        
        keyspace = cls.keyspace
        tpl = cls.keyspace_template
        key = "%s" % key if keyspace is None else tpl % (keyspace, key)
        return cls.keyparse.encode(key)
628783
def load_data(fname):
    
    print('Loading ' + fname + ' to redis')
    r = redis.StrictRedis(host = '127.0.0.1', port = 6379, db = 0);
    with open(fname, 'r') as f:
        for line_num, row in enumerate(f): 
            if row.strip('') != '':
                if line_num < 100000000:
                    l_key, l_val = parse_n3(row, 'csv')
                    if line_num % 1000 == 0: 
                        print('loading line #', line_num, 'key=', l_key, ' = ', l_val)
                    if l_key != '':
                        r.set(l_key, l_val)
182963
def load_store(cls, store, decoder=None):
        
        variables, attributes = store.load()
        if decoder:
            variables, attributes = decoder(variables, attributes)
        obj = cls(variables, attrs=attributes)
        obj._file_obj = store
        return obj
513457
def _load(self, key):
        '''
        
        '''
        # if the key doesn't have a '.' then it isn't valid for this mod dict
        if not isinstance(key, six.string_types):
            raise KeyError('The key must be a string.')
        if '.' not in key:
            raise KeyError('The key \'{0}\' should contain a \'.\''.format(key))
        mod_name, _ = key.split('.', 1)
        with self._lock:
            # It is possible that the key is in the dictionary after
            # acquiring the lock due to another thread loading it.
            if mod_name in self.missing_modules or key in self._dict:
                return True
            # if the modulename isn't in the whitelist, don't bother
            if self.whitelist and mod_name not in self.whitelist:
                log.error(
                    'Failed to load function %s because its module (%s) is '
                    'not in the whitelist: %s', key, mod_name, self.whitelist
                )
                raise KeyError(key)

            def _inner_load(mod_name):
                for name in self._iter_files(mod_name):
                    if name in self.loaded_files:
                        continue
                    # if we got what we wanted, we are done
                    if self._load_module(name) and key in self._dict:
                        return True
                return False

            # try to load the module
            ret = None
            reloaded = False
            # re-scan up to once, IOErrors or a failed load cause re-scans of the
            # filesystem
            while True:
                try:
                    ret = _inner_load(mod_name)
                    if not reloaded and ret is not True:
                        self._refresh_file_mapping()
                        reloaded = True
                        continue
                    break
                except IOError:
                    if not reloaded:
                        self._refresh_file_mapping()
                        reloaded = True
                    continue

        return ret
1271712
def load(klass, client, id, **kwargs):
        """"""
        resource = klass.RESOURCE.format(id=id)
        response = Request(client, 'get', resource, params=kwargs).perform()
        return klass(client).from_response(response.body['data'])
598649
def get(self, part):
        
        redis_key = ':'.join([self.namespace, self.key, part])

        objectType = self.conn.type(redis_key)
        if objectType == "string":
            self._data[part] = self.conn.get(redis_key)

        elif objectType == "list":
            self._data[part] = RedisList(redis_key, self.conn)

        else:
            raise RedisORMException("Other types besides string and list are unsupported at this time.")
1135680
def get(self, key):
        
        value = redis_conn.get(key)

        if value is not None:
            value = pickle.loads(value)

        return value
999723
def load!(id)
      self.__robject.key = id
      __load_robject! id, @__robject.reload(force: true)
    end
293339
def load(key, options = {})
      return super if options.include?(:raw)
      value, expires = load_entry(key, options)
      value
    end
222197
def _load(self):
        """"""

        self.session_id = self._session_object.get_session_id()

        # protection against session_id tampering
        if self.session_id and not self._valid_session_id(self.session_id):
            self.session_id = None

        if self.session_id:
            d = self.store[self.session_id]
            if isinstance(d, dict) and d:
                self.update(d)

        if not self.session_id:
            self.session_id = self._session_object.generate_session_id()

        if not self._data:
            if self._initializer and isinstance(self._initializer, dict):
                self.update(deepcopy(self._initializer))

        self._session_object.set_session_id(self.session_id)