The data obtained by nodejs redis is returned by Synchronize.

topic description

nodejs redis gets the data and Synchronize returns

sources of topics and their own ideas

Synchronize returns the data saved by redis

related codes

// 

/**
 * string
 * @param key 
 * @param callBack(err,result)
 */
db.get = function(key, callback){
    client.get(key, function(err,result){
        if (err) {
            console.log(err);
            callback(err,null)
            return;
        }

        callback(null,result);
    });
}
    //
    Redis.set("GetColumnList","",3600,redis.print);
    //
    var data=  Redis.get("GetColumnList",redis.print);
    if (data!=null && data!=undefined && data!="") {
        console.log(data);
        res.send(data);
    }else {
        console.log(data);
        res.send("");
    }

what result do you expect? What is the error message actually seen?

Synchronize returns data

Aug.14,2021

redis acquires content asynchronously, which is usually provided by the callback parameter. You need to obtain the content in the callback. Or directly use async/await to implement

// async + await 
async function test() {
  await Redis.set('something', '');

  const data = await Redis.get('something');

  // 
  console.log(data);
}

refer to koa2

Menu