小编典典

redisClient.set:-没有更新没有错误

redis

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

通过网络嵌套更新,打印“ abc已更新”,但实际值在Redis数据库中不更新。

注意:-上面的代码在localhost上有效,但更新未在heroku-redistogo上显示。

编辑:-我在本地主机上运行代码,redis连接到Redistogo。使用以下代码:-

设置快速会议:-

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

我还使用以下代码创建了另一个redisClient:

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

阅读 582

收藏
2020-06-20

共1个答案

小编典典

abc updated在Heroku上运行此代码时,您是否在控制台内看到?这似乎是Redis客户端的错误配置。

2020-06-20