【问题标题】:redisClient.set :- no update no errorredisClient.set :- 没有更新没有错误
【发布时间】:2013-12-08 23:22:42
【问题描述】:
redisClient.get('abc', function(err, abcValue){
 console.log(abcValue);
 abcValue = abcValue + 'id';
 redisClient.set('abc', abcValue, function(err){
  console.log('abc updated');
 });
});

通过网络进行嵌套更新,打印“abc updated”,但实际值不会在 redis 数据库中更新。

注意:- 上面的代码在本地主机上工作,但更新没有显示在 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');
});

【问题讨论】:

    标签: heroku redis updates redistogo


    【解决方案1】:

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

    【讨论】:

    • 我在控制台看到abc updated。我正在编辑中添加更多代码。
    猜你喜欢
    • 1970-01-01
    • 2014-09-22
    • 1970-01-01
    • 2021-03-09
    • 1970-01-01
    • 1970-01-01
    • 2021-07-28
    • 2019-02-07
    • 1970-01-01
    相关资源
    最近更新 更多