29 Jun 2018 11:06:14.626136 <190>1 2018-06-29T18:06:14.346750+00:00 app web.1 - - ReplyError: NOAUTH Authentication required
at new Command (/app/node_modules/redis/lib/command.js:12:22)
at RedisClient.info (/app/node_modules/redis/lib/individualCommands.js:169:39)
at RedisClient.ready_check (/app/node_modules/redis/index.js:534:10)
at RedisClient.on_connect (/app/node_modules/redis/index.js:428:14)
at Socket.<anonymous> (/app/node_modules/redis/index.js:268:14)
at Object.onceWrapper (events.js:313:30)
at emitNone (events.js:111:20)
at Socket.emit (events.js:208:7)
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1173:10)Exception
// From this code
var redis = require("redis"),
client = redis.createClient();
client.on("connect", function () {
client.set("foo_rand000000000000", "some fantastic value", redis.print);
client.get("foo_rand000000000000");
});
// To this code
var redis = require("redis"),
client = redis.createClient();
client.on("connect", function () {
client.set("foo_rand000000000000", "some fantastic value", redis.print);
var temp = client.get("foo_rand000000000000",function (err, data) {console.log(data)});
console.log(temp) // I Understand client.get will return boolean value. is there any way where temp can have value as "some fantastic value"
client.quit();
});
Can anyone please tell me how can I perform a transaction in redis while watching the the hash key foo and set a value with key test and value fooTest. The multi is executing with ok but the value is not set in redis.
redisClient.watch("foo", function (err) {
if (err) {
console.log('There was an error while watching the key foo.');
}
// Is this the correct usage of multi with hset i could not find it anywhere in documentation?
// The documentation just says that it will watch the whole hash and trigger if any value of the hash is modified.
redisClient.multi().hset(data.conversationID, helper.lastActivity, data.sentTimeStamp).exec(function (err, result) {
if (err) {
console.log('There was an error while executing the multi query');
}
if (result === null) {
console.log('The transaction was not performed since the data was accessed by someone else during the transaction and changed.');
}
});
});
This gives a result [OK] when logged but the value is updated.
redisClient
options as prefix)
I want to increment a key every n seconds in redis using nodejs.
I thought of implementing it like below :
function func(id1, max){
for(i=0; i < max; i++){
client.incr(id1, (error, value) => {
if(error){
console.log("redis incr failed : " + error);
return error;
}
console.log("updated value : " + value);
});
sleep.sleep(1);
}
client.quit();
return("incr value ended for : " + id);
}
func(id1, max);
But then in this case the complete redis incr happens in a stretch and the callback (console.log("updated value : " + value")) happens with delay (sleep 1).
Afaik, it is caused due to the nodejs being synchronous and (I think) the node_redis client being async.
Could anyone here please help me with this ? Thank you in advance!
null
or undefined
?
I have a set called "allguilds." I am using this to check if an ID is in there and if so apply a different element. But when I load the page It does probably half or so correct then mixes the set and guild ID.
Not working: 0 for guild undefined, set 373596097869905921.
Working: 1 for guild 539185945442910218, set allguilds.
I use this redis.check('allguilds', guild.id).then(function(res)
. That is
check: (set, guild) => client.sismemberAsync(set, guild).then(function(res) {
console.log(`${res} for guild ${guild}, set ${set}.`)
in the Redis file. I check if res === 1 and if so apply the different element Sorry for the edits forgot the markdown
Hi
I want convert my result from redisTemplate to my Object that I persisted into redis and got exeption:
Set<Object> cache = sessionRepository.getSetOps(sessionId);
userSession = mapper.convertValue(cache, UserSession.class);
And the exception:
at [Source: UNKNOWN; line: -1, column: -1]] with root cause
com.fasterxml.jackson.databind.exc.MismatchedInputException: Cannot deserialize instance of `com.rh.cores.architecture.model.rbac.UserSession` out of START_ARRAY token
at [Source: UNKNOWN; line: -1, column: -1]