Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// @flow
import type { Pool } from 'generic-pool';
import type { GenericPoolOptions } from '../../flow/types/generic-pool';
const _ = require('lodash');
const Redis = require('ioredis');
const { createPool } = require('generic-pool');
let commands: Array = require('redis-commands').list;
// Make some alterations to the list of commands.
commands = _.difference(commands, ['monitor']);
commands.push('sentinel');
/**
* Interacts with the Redis cache via a connection pool transparently.
*/
class Cache {
/**
* The pool of connections.
*/
pool: Pool;
/**
* Constructs a cache object.
*
* @param {string} redisHost
* The redis host with the redis:// form.
* @param {Object} redisOptions