(cls, db, identifier=None, redis_key=None)
Load the object from redis. Use the identifier (colon-separated
        composite keys or the primary key) or the redis_key.
Load the object from redis. Use the identifier (colon-separated
        composite keys or the primary key) or the redis_key.
Load the object from redis . Use the identifier ( colon - separated composite keys or the primary key ) or the redis_key .
async def load(cls, db, identifier=None, redis_key=None):
        """Load the object from redis. Use the identifier (colon-separated
        composite keys or the primary key) or the redis_key.
        """
        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
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