I am trying to increment a value for a key-value in redis, if the value already exists in redis. For instance if we have
client.get(key, function checkRedis(err, data){
var redisData = JSON.parse(data);
if(redisData === null){
//do something
}else{
client.incr(redisData.val);
}
});
From my understanding, according to the documentation using "incr" should automatically increment that specific value by 1. But i am unable to see this happen successfuly, am i missing something