Where communities thrive

  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
Repo info
Pedro Miguel Pereira Serrano Martins
client.setAsync('hello', 'world').thenn(console.log)
Sumant Kanala
Hello everyone, hope you're doing good.
Fortunately part of what I wanted to ask is right there above my comment regarding setting of key-value pairs is async or not?
My other question is: can multiple key-value pairs be batched together and if so, is it guaranteed they're all set at the same time(assuming setting is async)?
Paul Sheldrake
i'm getting this error when I try and connect to redis but i am sending a password so I don't know why it's saying i'm not. anyone seen something like this before?
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
Is there any way to get the client .get output in variable for further use ?

// From this code 
var redis = require("redis"),
    client = redis.createClient();

client.on("connect", function () {
    client.set("foo_rand000000000000", "some fantastic value", redis.print);

// 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"
@Girish400 client.get method parameters consist of the value and the callback. Inside the callback, you have access to data, so you may pass the data to another function (that function could work with a temp variable). So, console.log(data) is exactly doing that.
Anybody is using this redis client in a serverless context ?
I would happy to chat because I have issue figuring it out how to design the client lifecycle regarding faas underlying container lifecycle
For instance, I think I should create the client outside the handler (for AWS Lambda) so that it's getting reuse after a cold start
should I disable the offline queue for instance ? or should I adjust the lambda time out with the retry strategy so that it doesn't interact with it ?
i cloned https://github.com/NodeRedis/node_redis and cd into the dir and npm install which created alocal folder
how to require('./path/rel/to/nodered/index.js'); give Error: Cannot find module csloder ?
uff, i will create pull request to update installs
Nissim Kurle

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.

does this client support streams, i cannot find an exmaple?
like simple XADD key ID field string [field string ...]
is this right https://www.npmjs.com/package/redis-streams or am i off into the blue?
may the worthy lords in here grant me guidance
does node js peform encryption of message or is it cleartext, also how about the password?
Paul DeCoursey
Been trying to play with the radisgraph module, but I can't get the node_redis client to send the graph.query commands correctly. Any thoughts on how one sends arbitrary commands correctly?
Paul DeCoursey
kind of looks like this is just a place where people talk to themselves, is this project still active?
Aditya Mertia
hello All. I am struggling to find a way to use Keyspace Notifications with node_redis lib. Can someone tell how to listen for changes in a redis key updates ?
Peter Schussheim
NodeRedis/node_redis#1254 has anyone found a solution to this issue?
Peter Schussheim
how can I ensure that connect-redis does NOT install a dependency to node-redis? i want to ONLY use ioredis as my client
Raghav Garg
Hello everyone,
I wanted to understand about redis pub/sub. Say if I have a producer which publish messages on multiple channels.
Now, should I create single subscriber and listen to all channel.
or should I create individual subscriber for every channel?
I want to understands what are the best practices..!
Thomas Persson
Hi, I have heard that Redis has subscribe functionality, can this be used to subscribe to changes? eg new, updated or deleted data?
Marwan Rabbâa
hi, I have an expected behavior with exists
I store in my local redis sess:85b92d88-0394-4d3e-a0ae-5a5f112aca50, but I can not find it with client.exists('85b92d88-0394-4d3e-a0ae-5a5f112aca50')
(I'm using sess in redisClient options as prefix)
Miguel Rodriquez Cabrera
Is it possible to store a gzipped JSON in redis?
Karan Thanvi

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) => {
                console.log("redis incr failed : " + error);
                return error;
            console.log("updated value : " + value);
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!

Tiago Correia
indeed @thanvi_karan_twitter you have to move the sleep to the inside of the callback on the client.incr
aso client.quit will run probably before any of the above cause its not blocking, and the callback "blocks" the code when it makes the request
try to give a look to callbacks / promises, before moving on I think
Karan Thanvi
@tiagocorreiaalmeida thanks. I read about the callbacks and event loop and get this working as of now.
Vlad Potra
Is it guaranteed that the retry_strategy's option parameter, includes both attempt and times_connected, defined and valid natural numbers?
Meaning, should I handle the corner case when these two parameters are null or undefined?
I am struggling with redis client creation using aws endpoint,
getting getaddrinfo ENOTFOUND error
const client = require("redis").createClient(6379, "AWS_ENDPOINT_STR", { no_ready_check: true });
above code I am using to connect redis server
Kiran Mathew Mohan
Can somebody please take a look at this NodeRedis/node_redis#1407
hey guys
i have a question
Anyone know how to run redis outside of clients machine. I want to run it on the host server
sry for my bubsauce question, it seems i had localhost socket url on production so i got confused with redis

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

Do we not have support of Redis streams (added in redis 5) yet ? I tried using XADD but I got an error: redisClient.xadd is not a function
Ebrahim Khosravani

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]
Hi All ,i have a question about the configure leader follower (master-slave) replication
https://images2018.cnblogs.com/blog/1075473/201807/1075473-20180730173207029-1055620923.png it not require to set the masterauth?
slaveof 6379 is ok? i mean in shell when i connected the follower node