NodeJS
Create client
const redis = require('redis')
Promise.promisifyAll(redis.RedisClient.prototype)
Promise.promisifyAll(redis.Multi.prototype)
// redis client for sessions
module.exports = async function(config) {
let redisConfig = config.get('redis', {})
Q.log.debug('Connecting to redis')
let client = redis.createClient(redisConfig)
client.on('error', err => Q.log.error({ err }, 'REDIS ERROR'))
await new Promise(function(resolve, reject) {
client.on('ready', function() {
Q.log.debug('Connected to Redis')
resolve(client)
})
})
return client
}Replace KEYS with SCAN.
The replacement.
Last updated
Was this helpful?