Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
Luke Pighetti
@lukepighetti
Hey everyone, I heard that node-redis has native support for promises but I this fails because ".then is not a function" client.set("string key", "string val", redis.print).then( res=>{ console.log(res) })
am I missing something simple?
Pedro Miguel Pereira Serrano Martins
@Fl4m3Ph03n1x
@lukepighetti yes, node-redis doesn't really have support for promises. You need to use bluebird and promisify the RedisClient and the Multi prototypes
then you need to calls methods using async
for example
client.setAsync('hello', 'world').thenn(console.log)
Sumant Kanala
@kanalasumant
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
@paulsheldrake
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
Girish400
@Girish400
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);
    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();
});
DaliusR
@DaliusR
@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.
ƇʘƁ̆ąƇ́
@anchnk
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 ?
hivemall
@hivemall
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 ?
hivemall
@hivemall
uff, i will create pull request to update installs
Nissim Kurle
@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.

hivemall
@hivemall
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
hivemall
@hivemall
does node js peform encryption of message or is it cleartext, also how about the password?
Paul DeCoursey
@optimuspaul
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
@optimuspaul
kind of looks like this is just a place where people talk to themselves, is this project still active?
Aditya Mertia
@adityamertia
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
@peterschussheim
NodeRedis/node_redis#1254 has anyone found a solution to this issue?
Peter Schussheim
@peterschussheim
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
@raghavgarg1257
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
@thomaspersson
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
@waghanza
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
@syntacticsolutions
Is it possible to store a gzipped JSON in redis?
Karan Thanvi
@thanvi_karan_twitter

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!

Tiago Correia
@tiagocorreiaalmeida
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
@kdthanvi
@tiagocorreiaalmeida thanks. I read about the callbacks and event loop and get this working as of now.
Thanks!
Vlad Potra
@Japjappedulap
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?
Atul
@atul.thorat_gitlab
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
@privateOmega
Can somebody please take a look at this NodeRedis/node_redis#1407
Pagnito
@Pagnito
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