0
function Redis(){

this.redis=require('redis-node');
this.client =this.redis.createClient(6377, '127.0.0.1', {detect_buffers: true});
this.client.auth("pwd");

}

module.exports=Redis;

Redis.prototype.setKeyValue=function(key,value){

var obj=this;
this.client.get(key,function(err,res){

    if(res==null){


        obj.client.set(key,value,function (err, result) {
            console.log(result); 
            obj.client.quit();//here im getting error as client doesn't have method quit
         });

    }
    else{

        console.log('Sorry!!!key is already exist');
    }
});


  };
4

2 に答える 2