redisClient.set:-没有更新没有错误 [英] redisClient.set :- no update no error
问题描述
redisClient.get('abc', function(err, abcValue){
console.log(abcValue);
abcValue = abcValue + 'id';
redisClient.set('abc', abcValue, function(err){
console.log('abc updated');
});
});
通过网络嵌套更新,打印"abc已更新",但实际值在Redis数据库中未更新.
nested updation over network, prints 'abc updated', but actual value does not update in redis database.
注意:-上面的代码在localhost上有效,但更新未在heroku-redistogo上显示.
Note:- the above code works on localhost, but update not showing on heroku-redistogo.
-我正在localhost上运行代码,并将redis连接到Redistogo.使用以下代码:-
- I'm running code on localhost, with redis connected to Redistogo. Using the following code:-
设置快速会话:-
app.use(express.session({
store: new RedisStore({
host: 'birdeye.redistogo.com',
port: 1384,
db: 'redistogo',
pass: '052940128c2f2452f73378588dd5fb129'
}),
secret: '1234567890QWERTY',
}));
我还使用以下代码创建另一个redisClient:-
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');
});
推荐答案
在Heroku上运行此代码时,您是否在控制台内看到abc updated
?这似乎是Redis客户端的错误配置.
Do you see abc updated
inside the console when running this code on Heroku ? It seems to be a misconfiguration of Redis client.
这篇关于redisClient.set:-没有更新没有错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!