import { IRedisOptions } from "./RedisOptions"; /** * Creates a Redis instance * * @constructor * @param {(number|string|Object)} [port=6379] - Port of the Redis server, * or a URL string(see the examples below), * or the `options` object(see the third argument). * @param {string|Object} [host=localhost] - Host of the Redis server, * when the first argument is a URL string, * this argument is an object represents the options. * @param {Object} [options] - Other options. * @param {number} [options.port=6379] - Port of the Redis server. * @param {string} [options.host=localhost] - Host of the Redis server. * @param {string} [options.family=4] - Version of IP stack. Defaults to 4. * @param {string} [options.path=null] - Local domain socket path. If set the `port`, * `host` and `family` will be ignored. * @param {number} [options.keepAlive=0] - TCP KeepAlive on the socket with a X ms delay before start. * Set to a non-number value to disable keepAlive. * @param {boolean} [options.noDelay=true] - Whether to disable the Nagle's Algorithm. By default we disable * it to reduce the latency. * @param {string} [options.connectionName=null] - Connection name. * @param {number} [options.db=0] - Database index to use. * @param {string} [options.username=null] - If set, client will send AUTH command with this user and password when connected. * @param {string} [options.password=null] - If set, client will send AUTH command * with the value of this option when connected. * @param {boolean} [options.dropBufferSupport=false] - Drop the buffer support for better performance. * This option is recommended to be enabled when * handling large array response and you don't need the buffer support. * @param {boolean} [options.enableReadyCheck=true] - When a connection is established to * the Redis server, the server might still be loading the database from disk. * While loading, the server not respond to any commands. * To work around this, when this option is `true`, * ioredis will check the status of the Redis server, * and when the Redis server is able to process commands, * a `ready` event will be emitted. * @param {boolean} [options.enableOfflineQueue=true] - By default, * if there is no active connection to the Redis server, * commands are added to a queue and are executed once the connection is "ready" * (when `enableReadyCheck` is `true`, * "ready" means the Redis server has loaded the database from disk, otherwise means the connection * to the Redis server has been established). If this option is false, * when execute the command when the connection isn't ready, an error will be returned. * @param {number} [options.connectTimeout=10000] - The milliseconds before a timeout occurs during the initial * connection to the Redis server. * @param {boolean} [options.autoResubscribe=true] - After reconnected, if the previous connection was in the * subscriber mode, client will auto re-subscribe these channels. * @param {boolean} [options.autoResendUnfulfilledCommands=true] - If true, client will resend unfulfilled * commands(e.g. block commands) in the previous connection when reconnected. * @param {boolean} [options.lazyConnect=false] - By default, * When a new `Redis` instance is created, it will connect to Redis server automatically. * If you want to keep the instance disconnected until a command is called, you can pass the `lazyConnect` option to * the constructor: * * ```javascript * var redis = new Redis({ lazyConnect: true }); * // No attempting to connect to the Redis server here. * // Now let's connect to the Redis server * redis.get('foo', function () { * }); * ``` * @param {Object} [options.tls] - TLS connection support. See https://github.com/luin/ioredis#tls-options * @param {string} [options.keyPrefix=''] - The prefix to prepend to all keys in a command. * @param {function} [options.retryStrategy] - See "Quick Start" section * @param {number} [options.maxRetriesPerRequest] - See "Quick Start" section * @param {number} [options.maxLoadingRetryTime=10000] - when redis server is not ready, we will wait for * `loading_eta_seconds` from `info` command or maxLoadingRetryTime (milliseconds), whichever is smaller. * @param {function} [options.reconnectOnError] - See "Quick Start" section * @param {boolean} [options.readOnly=false] - Enable READONLY mode for the connection. * Only available for cluster mode. * @param {boolean} [options.stringNumbers=false] - Force numbers to be always returned as JavaScript * strings. This option is necessary when dealing with big numbers (exceed the [-2^53, +2^53] range). * @param {boolean} [options.enableTLSForSentinelMode=false] - Whether to support the `tls` option * when connecting to Redis via sentinel mode. * @param {NatMap} [options.natMap=null] NAT map for sentinel connector. * @param {boolean} [options.updateSentinels=true] - Update the given `sentinels` list with new IP * addresses when communicating with existing sentinels. * @extends [EventEmitter](http://nodejs.org/api/events.html#events_class_events_eventemitter) * @extends Commander * @example * ```js * var Redis = require('ioredis'); * * var redis = new Redis(); * * var redisOnPort6380 = new Redis(6380); * var anotherRedis = new Redis(6380, '192.168.100.1'); * var unixSocketRedis = new Redis({ path: '/tmp/echo.sock' }); * var unixSocketRedis2 = new Redis('/tmp/echo.sock'); * var urlRedis = new Redis('redis://user:password@redis-service.com:6379/'); * var urlRedis2 = new Redis('//localhost:6379'); * var urlRedisTls = new Redis('rediss://user:password@redis-service.com:6379/'); * var authedRedis = new Redis(6380, '192.168.100.1', { password: 'password' }); * ``` */ export default Redis; declare function Redis(port: number, host: string, options: IRedisOptions): void; declare namespace Redis { var createClient: (...args: any[]) => any; var defaultOptions: IRedisOptions; } declare function Redis(path: string, options: IRedisOptions): void; declare namespace Redis { var createClient: (...args: any[]) => any; var defaultOptions: IRedisOptions; } declare function Redis(port: number, options: IRedisOptions): void; declare namespace Redis { var createClient: (...args: any[]) => any; var defaultOptions: IRedisOptions; } declare function Redis(port: number, host: string): void; declare namespace Redis { var createClient: (...args: any[]) => any; var defaultOptions: IRedisOptions; } declare function Redis(options: IRedisOptions): void; declare namespace Redis { var createClient: (...args: any[]) => any; var defaultOptions: IRedisOptions; } declare function Redis(port: number): void; declare namespace Redis { var createClient: (...args: any[]) => any; var defaultOptions: IRedisOptions; } declare function Redis(path: string): void; declare namespace Redis { var createClient: (...args: any[]) => any; var defaultOptions: IRedisOptions; } declare function Redis(): void; declare namespace Redis { var createClient: (...args: any[]) => any; var defaultOptions: IRedisOptions; }