expect(redis.createClient).toHaveBeenCalledWith('redisAddress', { socket_keepalive: true, no_ready_check: true, expect(redis.createClient).toHaveBeenCalledWith('redisAddress', { socket_keepalive: true, no_ready_check: true,
/** * 'retry' * */ var retry = function ( self ) { self.redisClient = redis.createClient(self.connection); self.netStream = self.redisClient.stream; self.attachStreams(); }
(() => { let _cache; let conf = config.get('CACHE:REDIS'); return () => { if (_cache === undefined) { _cache = conf && conf.HOST && !conf.DISABLED ? redis.createClient({host: conf.HOST}) : null; } return _cache; }; })()
const AsyncRedis = function (args) { const client = Array.isArray(args) ? redis.createClient(...args) : redis.createClient(args); return AsyncRedis.decorate(client); }
connect(callback) { this.client = redis.createClient(); this.client.on('error', (err) => { console.error("This demo requires Redis, a simple message broker. To install redis on Mac OS X, use `brew install redis`"); console.error("After installing, run `redis-server` in another terminal and restart this demo."); console.error(err); // In production, this will trigger a process monitor to restart the process. process.exit(); }); this.client.on('connect', callback); }
setup() { this.redisConfig = Object.assign({}, redisBaseConfig, this.options) this.redisClient = Redis.createClient(this.redisConfig) this.redisClient.on("error", function(error) { console.error(`❗️ Redis Error: ${error}`) }) this.redisClient.on("ready", () => { console.log('✅ 💃 redis have ready !') }) this.redisClient.on("connect", () => { console.log('✅ 💃 connect redis success !') }) }
async function processRedis(filename, api, apikey) { let client = redis.createClient(); let githubData = await getGithubData(api, apikey); // Do NOT forget to stringify the JSON !! githubData = JSON.stringify(githubData); let setAsync = promisify(client.set).bind(client); let writeResult = await setAsync(filename, githubData); console.log(`${writeResult} has been saved.`); client.quit(); }
(() => { try { let secret = require('./redis-secret.json') let redisClient = redis.createClient(secret.port, secret.host) redisClient.auth(secret.password) return redisClient } catch (e) { return redis.createClient() } })()
router.get('/clearcache', function(req,res,next){ var redis = require("redis"); var client = redis.createClient(config.redis); client.flushdb(function(){ return res.json({}); }); })
const redisTest = () => { const client = redis.createClient(redisConfig); client.set("foo_rand000000000000", "OK"); // This will return a JavaScript String client.get("foo_rand000000000000", function(err, reply) { console.log(reply.toString()); // Will print `OK` }); }
redis.createClient({ host: redis_host ,port: redis_port ,password:redis_pwd ,detect_buffers: true }) .on('error', function (err) { logger.error(redis_host + ":" + redis_port + " " + err); }) .on('connect', function () { logger.debug('Redis connected ' + redis_host + ":" + redis_port); })
function Presence() { this.client = redis.createClient({ host: config.REDIS_ENDPOINT }); }
/** * * @param {string} password */ constructor (password) { this.client = redis.createClient({ password, prefix: 'nodeLessons-' }) }
setup() { this.redisConfig = Object.assign({}, redisBaseConfig, this.options) this.redisClient = Redis.createClient(this.redisConfig) this.redisClient.on('error', function(error) { console.error(`❗️ Redis Error: ${error}`) }) this.redisClient.on('ready', () => { console.log('✅ 💃 redis have ready !') }) this.redisClient.on('connect', () => { console.log('✅ 💃 connect redis success !') }) }
constructor (config) { this.client = redis.createClient(config) }