Comparing version 5.0.0-beta.2 to 5.0.0-beta.3
@@ -151,8 +151,2 @@ /// <reference types="node" /> | ||
/** | ||
* See Redis class. | ||
* | ||
* @default 60000 | ||
*/ | ||
maxScriptsCachingTime?: number; | ||
/** | ||
* Custom LUA commands | ||
@@ -159,0 +153,0 @@ */ |
@@ -21,3 +21,2 @@ "use strict"; | ||
autoPipeliningIgnoredCommands: [], | ||
maxScriptsCachingTime: 60000, | ||
}; |
@@ -25,3 +25,9 @@ /// <reference types="node" /> | ||
export interface SentinelConnectionOptions { | ||
/** | ||
* Master group name of the Sentinel | ||
*/ | ||
name?: string; | ||
/** | ||
* @default "master" | ||
*/ | ||
role?: "master" | "slave"; | ||
@@ -42,2 +48,5 @@ tls?: ConnectionOptions; | ||
updateSentinels?: boolean; | ||
/** | ||
* @default 10 | ||
*/ | ||
sentinelMaxConnections?: number; | ||
@@ -44,0 +53,0 @@ failoverDetector?: boolean; |
@@ -31,4 +31,5 @@ export { default } from "./Redis"; | ||
export { Callback } from "./types"; | ||
export { SentinelAddress } from "./connectors/SentinelConnector"; | ||
export { RedisOptions } from "./redis/RedisOptions"; | ||
export { SentinelAddress, SentinelConnectionOptions, } from "./connectors/SentinelConnector"; | ||
export { StandaloneConnectionOptions } from "./connectors/StandaloneConnector"; | ||
export { RedisOptions, CommonRedisOptions } from "./redis/RedisOptions"; | ||
export declare const ReplyError: any; | ||
@@ -35,0 +36,0 @@ /** |
@@ -45,3 +45,3 @@ "use strict"; | ||
}, | ||
set(lib) { | ||
set(_lib) { | ||
console.warn("ioredis v5 does not support plugging third-party Promise library anymore. Native Promise will be used."); | ||
@@ -48,0 +48,0 @@ }, |
@@ -230,5 +230,9 @@ "use strict"; | ||
this.redis.connect().catch(utils_1.noop); | ||
if (callback && !this.nodeifiedPromise) { | ||
this.nodeifiedPromise = true; | ||
(0, standard_as_callback_1.default)(this.promise, callback); | ||
} | ||
this.redis.delayUntilReady((err) => { | ||
if (err) { | ||
callback(err); | ||
this.reject(err); | ||
return; | ||
@@ -235,0 +239,0 @@ } |
@@ -6,29 +6,113 @@ import { CommanderOptions } from "../utils/Commander"; | ||
export declare type ReconnectOnError = (err: Error) => boolean | 1 | 2; | ||
interface CommonRedisOptions extends CommanderOptions { | ||
export interface CommonRedisOptions extends CommanderOptions { | ||
Connector?: ConnectorConstructor; | ||
retryStrategy?: (times: number) => number | void | null; | ||
commandTimeout?: number; | ||
/** | ||
* Enable/disable keep-alive functionality. | ||
* @link https://nodejs.org/api/net.html#socketsetkeepaliveenable-initialdelay | ||
* @default 0 | ||
*/ | ||
keepAlive?: number; | ||
/** | ||
* Enable/disable the use of Nagle's algorithm. | ||
* @link https://nodejs.org/api/net.html#socketsetnodelaynodelay | ||
* @default true | ||
*/ | ||
noDelay?: boolean; | ||
/** | ||
* Set the name of the connection to make it easier to identity the connection | ||
* in client list. | ||
* @link https://redis.io/commands/client-setname | ||
*/ | ||
connectionName?: string; | ||
username?: string; | ||
password?: string; | ||
/** | ||
* @default 0 | ||
*/ | ||
db?: number; | ||
/** | ||
* @default true | ||
*/ | ||
autoResubscribe?: boolean; | ||
/** | ||
* Whether or not to resend unfulfilled commands on reconnect. | ||
* Unfulfilled commands are most likely to be blocking commands such as `brpop` or `blpop`. | ||
* @default true | ||
*/ | ||
autoResendUnfulfilledCommands?: boolean; | ||
reconnectOnError?: ReconnectOnError; | ||
/** | ||
* Whether or not to reconnect on certain Redis errors. | ||
* This options by default is `null`, which means it should never reconnect on Redis errors. | ||
* You can pass a function that accepts an Redis error, and returns: | ||
* - `true` or `1` to trigger a reconnection. | ||
* - `false` or `0` to not reconnect. | ||
* - `2` to reconnect and resend the failed command (who triggered the error) after reconnection. | ||
* @example | ||
* ```js | ||
* const redis = new Redis({ | ||
* reconnectOnError(err) { | ||
* const targetError = "READONLY"; | ||
* if (err.message.includes(targetError)) { | ||
* // Only reconnect when the error contains "READONLY" | ||
* return true; // or `return 1;` | ||
* } | ||
* }, | ||
* }); | ||
* ``` | ||
* @default null | ||
*/ | ||
reconnectOnError?: ReconnectOnError | null; | ||
/** | ||
* @default false | ||
*/ | ||
readOnly?: boolean; | ||
/** | ||
* When enabled, numbers returned by Redis will be converted to JavaScript strings instead of numbers. | ||
* This is necessary if you want to handle big numbers (above `Number.MAX_SAFE_INTEGER` === 2^53). | ||
* @default false | ||
*/ | ||
stringNumbers?: boolean; | ||
/** | ||
* @default 10000 | ||
*/ | ||
connectTimeout?: number; | ||
/** | ||
* @default false | ||
*/ | ||
monitor?: boolean; | ||
/** | ||
* @default 20 | ||
*/ | ||
maxRetriesPerRequest?: number; | ||
/** | ||
* @default 10000 | ||
*/ | ||
maxLoadingRetryTime?: number; | ||
/** | ||
* @default false | ||
*/ | ||
enableAutoPipelining?: boolean; | ||
/** | ||
* @default [] | ||
*/ | ||
autoPipeliningIgnoredCommands?: string[]; | ||
maxScriptsCachingTime?: number; | ||
offlineQueue?: boolean; | ||
commandQueue?: boolean; | ||
/** | ||
* @default true | ||
*/ | ||
enableOfflineQueue?: boolean; | ||
/** | ||
* @default true | ||
*/ | ||
enableReadyCheck?: boolean; | ||
/** | ||
* @default false | ||
*/ | ||
lazyConnect?: boolean; | ||
/** | ||
* @default undefined | ||
*/ | ||
scripts?: Record<string, { | ||
@@ -42,2 +126,1 @@ lua: string; | ||
export declare const DEFAULT_REDIS_OPTIONS: RedisOptions; | ||
export {}; |
@@ -54,4 +54,3 @@ "use strict"; | ||
autoPipeliningIgnoredCommands: [], | ||
maxScriptsCachingTime: 60000, | ||
sentinelMaxConnections: 10, | ||
}; |
{ | ||
"name": "ioredis", | ||
"version": "5.0.0-beta.2", | ||
"version": "5.0.0-beta.3", | ||
"description": "A robust, performance-focused and full-featured Redis client for Node.js.", | ||
@@ -5,0 +5,0 @@ "main": "./built/index.js", |
@@ -53,3 +53,3 @@ [![ioredis](https://cdn.jsdelivr.net/gh/luin/ioredis@b5e8c74/logo.svg)](https://github.com/luin/ioredis) | ||
- [API Documentation](http://luin.github.io/ioredis/) ([Redis](http://luin.github.io/ioredis/classes/default.html), [Cluster](http://luin.github.io/ioredis/classes/Cluster.html)) | ||
- [Changelog](Changelog.md) | ||
- [Changelog](CHANGELOG.md) | ||
- [Migrating from node_redis](https://github.com/luin/ioredis/wiki/Migrating-from-node_redis) | ||
@@ -193,3 +193,3 @@ - [Error Handling](#error-handling) | ||
See [API Documentation](API.md#new-redisport-host-options) for all available options. | ||
See [API Documentation](http://luin.github.io/ioredis/index.html#RedisOptions) for all available options. | ||
@@ -196,0 +196,0 @@ ## Pub/Sub |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
669749
14756