问题
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