skip to Main Content

How to hold a lock to redis?

I have the following NodeJS code that initialize a list only if the list doesn't exist. if (redisClient.lLen('mylist') === 0) { let initialVal = Array(100).fill(-1) await redisClient.rPush('mylist', initialVal) } If the above code is running at the same time by…

VIEW QUESTION

Unable to connect to remote redis host [nodeJS]

const redis = require('redis'); require('dotenv').config(); console.log(process.env.redisHost, ':', process.env.redisPort); const redisClient = redis.createClient({ host: process.env.redisHost, port: process.env.redisPort, password: process.env.redisKey }); redisClient.connect(); redisClient.on('error', err => console.log('Redis error: ', err.message)); redisClient.on('connect', () => console.log('Connected to redis server')); module.exports = redisClient; I tried this…

VIEW QUESTION
Back To Top
Search