Where communities thrive

  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
Repo info
Hello, we are using node_redis in a serverless architecture (hosted on AWS) inside a Lambda. This Lambda is triggered by a dynamoDB stream (whenever changes are made to the database) and it should update the Redis cache. So the Redis cache should be an exact copy of the dynamoDB's items. We figured it out that we had some inconsistencies in the cache (2 items where missing). As of now, there aren't any listeners attached to the Client Object returned by redis.createClient. What would be the good strategy to be able to debug that issue and ensure all transactions are safely handled ? The need is really to be sure that the cache is consistent with the database
Hi i have a database with about 2 million keys. all start with v:s:KEYNAME. Is it possible to get 10 ramdom keys out of the 2 million somehow? When i have a SET i use SRANDMEMBER but how can i get here out of the keys that start with v:s: random keys?
Quentin Sommer
Hi guys! I have an architecture question about handling idle clients that are left after objects get garbage collected, if anyone already worked on a similar problem : NodeRedis/node_redis#1338
Tiago Correia
hey anyon around
Carlos Linares
Hi, https://redis.io/commands/zpopmax and https://redis.io/commands/zpopmin are undefined when trying to execute those function in node redis client ("redis": "^2.8.0"), there is a way to call those functions?
Hi,I have question about keyspace notifications,does redis cluster not support it ?
Pedro Miguel Pereira Serrano Martins
Hello all, I have created an issue with a Question and a Feature Request for documenting WATCH with node-redis. Please review at your earliest convinience: NodeRedis/node_redis#1349
Luke Pighetti
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
@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
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?