node-redis is a complete Redis client for node.js. It supports all Redis commands, including many recently added commands like EVAL from experimental Redis server branches.
Questions tagged [node-redis]
756 questions
15
votes
2 answers
How to save javascript array as redis list
The following code save the whole array as single value in redis list. But I want to save array values individually. How can I do it?
P.S So sorry for poor English.
var redis = require('redis'),
client = redis.createClient();
var arr =…

Thant Sin Aung
- 682
- 2
- 10
- 20
14
votes
3 answers
How to send data from client to redis and then after to laravel
I'm using laravel and redis for real time chat. I can fire event from my laravel and receiving that data to client side.
My problem is how can i send something from client and then receive it to redis and pass it to laravel
E.g How can i check if…

Mr. Engineer
- 3,522
- 4
- 17
- 34
14
votes
4 answers
How to pipeline in node.js to redis?
I have lot's of data to insert (SET \ INCR) to redis DB, so I'm looking for pipeline \ mass insertion through node.js.
I couldn't find any good example/ API for doing so in node.js, so any help would be great!

Aviram Netanel
- 12,633
- 9
- 45
- 69
13
votes
4 answers
Node.js: Jest + redis.quit() but open handle warning persists
I'm trying to run an integration test with redis and jest.
It always throws the "Jest has detected the following 1 open handle potentially keeping Jest from exiting:" error when running with --detectOpenHandles.
It doesn't hang so the socket is…

Willy Zhang
- 473
- 4
- 12
12
votes
1 answer
Redis tests don't exit after passing (using jest)
I implemented basic caching functionality for a project and ran into a problem during the testing.
I test using jest and redis-mock and all the tests pass.
The problem is when I import a file which imports the redis-file.
The test-file doesn't…

Lennert Hofman
- 585
- 6
- 21
12
votes
1 answer
How to namespace keys on redis to avoid name collisions?
I want to use redis to store some of my own key-value pairs, however some of my modules already use it. The redis express session store for session data, as well as the redis adapter for socket io. So my question is simple, how can I create or…

naughty boy
- 2,089
- 3
- 18
- 28
12
votes
4 answers
Delete array of keys in redis using node-redis
I have arrays of keys like ["aaa","bbb","ccc"] so I want to delete all these keys from redis using one command . I donot want to iterate using loop . I read about redis command DEL and on terminal redis-client it works but using nodejs it does not…

abhaygarg12493
- 1,565
- 2
- 20
- 40
11
votes
0 answers
Redis connection to redis.abc.abc failed - write EPIPE
Unable to connect to Redis from NodeJS with following error:
Redis connection to redis.example.com failed - write EPIPE
Using NodeJS version v0.10.35
node_redis module 0.12.1 & Redis DB version 3.0.4
Currently, NodeJS server is processing around…

Ayaz Pasha
- 1,045
- 6
- 13
- 28
11
votes
4 answers
Redis WATCH MULTI EXEC by one client
I am using NodeJS + Express + Redis on RedisOnGo + node_redis as a client. I expect a lot of concurrency, so trying to test WATCH. This example won't contain Express, just necessary stuff.
var redis = require("redis")
var rc =…

igorpavlov
- 3,576
- 6
- 29
- 56
11
votes
2 answers
Make Node Redis get() Synchronous
i just started implementing redis with node. during an implementation of authentication method i need to check whether the token exist in redis, if not update the new token in redis and in my mongo db for that i need to write a big callback block…

Jaison Justus
- 2,753
- 8
- 47
- 65
10
votes
3 answers
Reusing Redis Connection: Socket Closed Unexpectedly - node-redis
First, let me tell you how I'm using Redis connection in my NodeJS application:
I'm re-using one connection throughout the app using a singleton class.
class RDB {
static async getClient() {
if (this.client) {
return…

Yash Dixit
- 216
- 3
- 12
10
votes
2 answers
Node js redis set data at once
I started learning redis and nodejs ,
I am getting data from third party api call. I want to save this data into my redis server. I am able to do that
but I got a problem that if i get data
in json array with multiple keys I am not able to insert…

user3060781
- 131
- 1
- 7
10
votes
2 answers
Node.js: Closing all Redis clients on shutdown
Today, I integrated Redis into my node.js application and am using it as a session store. Basically, upon successful authentication, I store the corresponding user object in Redis.
When I receive http requests after authentication, I attempt to…

shaunlim
- 4,384
- 6
- 33
- 38
9
votes
2 answers
how to mock node-redis using jest
i am using jest and trying to mock node-redis using redis-mock.
// redis.js
const redis = require("redis");
const client = redis.createClient({ host: '127.0.0.1', port: 6379 });
// redis.test.js
const redisMock =…

Mr.
- 9,429
- 13
- 58
- 82
9
votes
1 answer
How to detect client disconnect from redis in nodejs?
I am using the library node_redis as the client for a micro-service message client that I am writing. Clients get messages from their application in their outbox that they need to send to other services. Everything is working great but I am trying…

tensai
- 1,628
- 3
- 17
- 22