Home  >  Q&A  >  body text

node无法get到redis中的值?求教

我用node操作redis 可以set 但是get的时候总是null 我在redis-cli下却可以get到值 这是为什么呢 有人知道吗

伊谢尔伦伊谢尔伦2705 days ago663

reply all(1)I'll reply

  • 曾经蜡笔没有小新

    曾经蜡笔没有小新2017-04-25 09:06:36

    Redis’ callback function parameter type is error-first, similar to this

    redis.get('name',function(err,result){
        if(err){
            //do
        }else{
            console.log(err) //null
            console.log(result) //get answer
        }
    })

    Are you missing some parameters, something like this

    redis.get('name',function(result){
        console.log(result)//null 
    })

    reply
    0
  • Cancelreply