redisClient.set :- no update no error

删除回忆录丶 提交于 2019-12-13 05:27:53

问题


redisClient.get('abc', function(err, abcValue){
 console.log(abcValue);
 abcValue = abcValue + 'id';
 redisClient.set('abc', abcValue, function(err){
  console.log('abc updated');
 });
});

nested updation over network, prints 'abc updated', but actual value does not update in redis database.

Note:- the above code works on localhost, but update not showing on heroku-redistogo.

Edit:- I'm running code on localhost, with redis connected to Redistogo. Using the following code:-

Setting up of express session:-

app.use(express.session({ 
    store: new RedisStore({
        host: 'birdeye.redistogo.com',
        port: 1384,
        db: 'redistogo',
        pass: '052940128c2f2452f73378588dd5fb129'
  }),
     secret: '1234567890QWERTY',
}));

I am also creating another redisClient using the following code:-

var redisClient = require('redis').createClient( 1384, 'birdeye.redistogo.com', {detect_buffers: true});
redisClient.auth('052940128c2f2452f73378588dd5fb129', function() {
    console.log('Redis client connected');
});

回答1:


Do you see abc updated inside the console when running this code on Heroku ? It seems to be a misconfiguration of Redis client.



来源:https://stackoverflow.com/questions/20334805/redisclient-set-no-update-no-error

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!