### Example clusterNodeRetryStrategy Source: https://redis.github.io/ioredis/interfaces/ClusterOptions.html An example implementation of the clusterNodeRetryStrategy function. ```javascript clusterNodeRetryStrategy: (times) => Math.min(times * 100, 3000) ``` -------------------------------- ### Configure reconnectOnError Source: https://redis.github.io/ioredis/interfaces/CommonRedisOptions.html Example of using a function to determine whether to reconnect based on a specific error message. ```javascript 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;` } }, }); ``` -------------------------------- ### Create and execute a Command instance Source: https://redis.github.io/ioredis/classes/Command.html Demonstrates creating a Command instance with a callback or using the promise property when no callback is provided. ```javascript var infoCommand = new Command('info', null, function (err, result) { console.log('result', result); }); redis.sendCommand(infoCommand); // When no callback provided, Command instance will have a `promise` property, // which will resolve/reject with the result of the command. var getCommand = new Command('get', ['foo']); getCommand.promise.then(function (result) { console.log('result', result); }); ``` -------------------------------- ### new Command(name, args?, options?, callback?) Source: https://redis.github.io/ioredis/classes/Command.html Creates an instance of Command. The constructor accepts a command name, an array of arguments, optional options, and an optional callback. If no callback is provided, the command instance will have a promise property that resolves or rejects with the result. ```APIDOC ## new Command(name, args?, options?, callback?) ### Description Creates an instance of Command. ### Constructor new Command(name, args?, options?, callback?): Command ### Parameters - **name** (string) - Required - Command name - **args** (ArgumentType[]) - Optional - An array of command arguments (default: []) - **options** (CommandOptions) - Optional - Command options (default: {}) - **callback** (Callback) - Optional - The callback that handles the response. If omitted, the response will be handled via Promise ### Returns Command ### Example ```javascript var infoCommand = new Command('info', null, function (err, result) { console.log('result', result); }); redis.sendCommand(infoCommand); // When no callback provided, Command instance will have a `promise` property, // which will resolve/reject with the result of the command. var getCommand = new Command('get', ['foo']); getCommand.promise.then(function (result) { console.log('result', result); }); ``` ``` -------------------------------- ### new SentinelConnector(options) Source: https://redis.github.io/ioredis/classes/SentinelConnector.html Constructor for the SentinelConnector class. ```APIDOC ## new SentinelConnector(options) ### Description Creates a new SentinelConnector instance with the given Sentinel connection options. ### Constructor `new SentinelConnector(options)` ### Parameters - **options** (SentinelConnectionOptions) - Required - The Sentinel connection options. ### Returns - **SentinelConnector** - A new SentinelConnector instance. ``` -------------------------------- ### connect(eventEmitter) Source: https://redis.github.io/ioredis/classes/SentinelConnector.html Method to connect to the Sentinel. ```APIDOC ## connect(eventEmitter) ### Description Establishes a connection using the provided event emitter and returns a promise that resolves to a NetStream. ### Method `connect(eventEmitter)` ### Parameters - **eventEmitter** (ErrorEmitter) - Required - The error emitter for the connection. ### Returns - **Promise** - A promise that resolves to a NetStream. ``` -------------------------------- ### constructor Source: https://redis.github.io/ioredis/classes/SentinelIterator.html Creates a new SentinelIterator instance with the given list of sentinels. ```APIDOC ## new SentinelIterator(sentinels) ### Description Creates a new SentinelIterator instance. ### Parameters - **sentinels** (Partial[]) - Required - The list of sentinel addresses to iterate over. ### Returns - **SentinelIterator** - The new iterator instance. ``` -------------------------------- ### ClusterOptions Source: https://redis.github.io/ioredis/interfaces/ClusterOptions.html Options for the Cluster constructor. This interface extends CommanderOptions and includes properties for configuring retry strategies, auto-pipelining, DNS resolution, and other cluster-specific behaviors. ```APIDOC ## ClusterOptions ### Description Options for the Cluster constructor in ioredis. This interface extends CommanderOptions and includes properties for configuring retry strategies, auto-pipelining, DNS resolution, and other cluster-specific behaviors. ### Properties - **autoPipeliningIgnoredCommands** (string[]) - Optional - Commands that should not be auto-pipelined. - **clusterNodeRetryStrategy** ((times) => number | void) - Optional - Retry strategy for individual cluster nodes. - **clusterRetryStrategy** ((times, reason?) => number | void) - Optional - Retry strategy for the cluster as a whole. - **dnsLookup** (DNSLookupFunction) - Optional - Custom DNS lookup function. - **enableAutoPipelining** (boolean) - Optional - Whether to enable auto-pipelining. - **enableOfflineQueue** (boolean) - Optional - Whether to enable the offline queue. - **enableReadyCheck** (boolean) - Optional - Whether to enable the ready check. - **himportFieldsets** (readonly HimportFieldset[]) - Optional - Fieldsets for himport. - **keyPrefix** (string) - Optional - Prefix for all keys. - **lazyConnect** (boolean) - Optional - Whether to connect lazily. - **maxRedirections** (number) - Optional - Maximum number of redirections. - **natMap** (NatMap) - Optional - NAT mapping for cluster nodes. - **redisOptions** (Omit) - Optional - Options for the underlying Redis client. - **resolveSrv** (DNSResolveSrvFunction) - Optional - Custom SRV record resolution function. - **retryDelayOnClusterDown** (number) - Optional - Delay in milliseconds before retrying when the cluster is down. - **retryDelayOnFailover** (number) - Optional - Delay in milliseconds before retrying after a failover. - **retryDelayOnMoved** (number) - Optional - Delay in milliseconds before retrying after a MOVED error. - **retryDelayOnTryAgain** (number) - Optional - Delay in milliseconds before retrying after a TRYAGAIN error. - **scaleReads** (Function | NodeRole) - Optional - Strategy for scaling reads across nodes. - **scripts** (Record) - Optional - Custom Lua scripts. - **shardedSubscribers** (boolean) - Optional - Whether to use sharded subscribers. - **showFriendlyErrorStack** (boolean) - Optional - Whether to show friendly error stacks. - **slotsRefreshInterval** (number) - Optional - Interval in milliseconds for refreshing slot information. - **slotsRefreshTimeout** (number) - Optional - Timeout in milliseconds for slot refresh. - **useSRVRecords** (boolean) - Optional - Whether to use SRV records for discovery. ``` -------------------------------- ### toWritable(_socket) Source: https://redis.github.io/ioredis/classes/Command.html Converts the command to a writable buffer or string. This is used to prepare the command for sending over a socket. ```APIDOC ## toWritable(_socket) ### Description Convert command to writable buffer or string. ### Method toWritable ### Parameters - **_socket** (object) - Required - The socket object. ### Returns - **string | Buffer** - The writable representation of the command. ``` -------------------------------- ### getKeys() Source: https://redis.github.io/ioredis/classes/Command.html Returns the keys associated with the command. This method is used to retrieve the keys that the command operates on. ```APIDOC ## getKeys() ### Description Returns the keys associated with the command. ### Method getKeys ### Returns - **(string | Buffer)[]** - An array of keys, each being a string or Buffer. ``` -------------------------------- ### setReplyContext(context) Source: https://redis.github.io/ioredis/classes/Command.html Sets the reply context for the command. This is used to provide context for reply transformation. ```APIDOC ## setReplyContext(context) ### Description Sets the reply context for the command. ### Method setReplyContext ### Parameters - **context** (ReplyContext) - Required - The reply context. ### Returns - **void** ``` -------------------------------- ### next Source: https://redis.github.io/ioredis/classes/SentinelIterator.html Returns the next sentinel in the iteration. ```APIDOC ## next() ### Description Returns the next sentinel in the iteration. ### Returns - **Object** - An object with the following properties: - **done** (boolean) - Whether the iteration is complete. - **value** (Partial) - The current sentinel address. ``` -------------------------------- ### ClusterOptions Properties Source: https://redis.github.io/ioredis/interfaces/ClusterOptions.html Configuration options for the ioredis Cluster client, including retry strategies, DNS resolution, pipelining, and more. ```APIDOC ## ClusterOptions Properties ### autoPipeliningIgnoredCommands - **Type**: `string[]` - **Optional**: Yes - **Description**: See Redis class. - **Default**: `[]` ### clusterNodeRetryStrategy - **Type**: `(times: number) => number | void` - **Optional**: Yes - **Description**: When a cluster node connection is closed, this function will be called to determine the retry delay (in ms). Returning `null` or a non-number disables reconnection for that node. By default this is `null`, meaning cluster nodes will NOT automatically reconnect — the cluster relies on `MOVED` errors to refresh topology. Set this to enable reconnection, e.g. for replica nodes that restart without any slot changes. - **Parameters**: - `times` (number) - The number of retry attempts. - **Returns**: `number | void` - The retry delay in milliseconds, or `void`/`null` to disable reconnection. - **Example**: `clusterNodeRetryStrategy: (times) => Math.min(times * 100, 3000)` - **Default**: `null` ### clusterRetryStrategy - **Type**: `(times: number, reason?: Error) => number | void` - **Optional**: Yes - **Description**: See "Quick Start" section. - **Parameters**: - `times` (number) - The number of retry attempts. - `reason` (Error, optional) - The error that caused the retry. - **Returns**: `number | void` - The retry delay in milliseconds, or `void` to stop retrying. - **Default**: `(times) => Math.min(100 + times * 2, 2000)` ### dnsLookup - **Type**: `DNSLookupFunction` - **Optional**: Yes - **Description**: Hostnames will be resolved to IP addresses via this function. This is needed when the addresses of startup nodes are hostnames instead of IPs. You may provide a custom `lookup` function when you want to customize the cache behavior of the default function. - **Default**: `require('dns').lookup` ### enableAutoPipelining - **Type**: `boolean` - **Optional**: Yes - **Description**: See Redis class. - **Default**: `false` ### enableOfflineQueue - **Type**: `boolean` - **Optional**: Yes - **Description**: See Redis class. - **Default**: `true` ### enableReadyCheck - **Type**: `boolean` - **Optional**: Yes - **Description**: When enabled, ioredis only emits "ready" event when `CLUSTER INFO` command reporting the cluster is ready for handling commands. - **Default**: `true` ### himportFieldsets - **Type**: `readonly HimportFieldset[]` - **Optional**: Yes - **Experimental**: Yes - **Description**: Managed-fieldset support is experimental and requires Redis 8.10 or newer. Long-lived HIMPORT fieldsets managed across all current and future master connections for the lifetime of this Cluster client. Configure this option at the top level, not under `redisOptions`. When a managed `HIMPORT SET` needs fieldset preparation or recovery, later commands issued on this Cluster client may be sent before that SET resumes. Await the SET before issuing commands that depend on its write. Explicit pipelines containing a managed `HIMPORT SET` wait for required fieldset preparation on the selected master before the batch is sent. Background preparation failures do not prevent the connection from becoming ready and are reported through the `node error` event. A dependent managed `HIMPORT SET` retries preparation and rejects if recovery fails. Direct `HIMPORT PREPARE`, `DISCARD`, and `DISCARDALL` calls fan out to all current masters. Within an explicit pipeline, these commands remain connection-affine and are not managed. Use explicit HIMPORT commands on a separate unconfigured client for bounded, manually managed batches. - **Default**: `undefined` ### keyPrefix - **Type**: `string` - **Optional**: Yes - **Description**: (No description provided) ### lazyConnect - **Type**: `boolean` - **Optional**: Yes - **Description**: By default, When a new Cluster instance is created, it will connect to the Redis cluster automatically. If you want to keep the instance disconnected until the first command is called, set this option to `true`. - **Default**: `false` ### maxRedirections - **Type**: `number` - **Optional**: Yes - **Description**: When a MOVED or ASK error is received, client will redirect the command to another node. This option limits the max redirections allowed to send a command. - **Default**: `16` ### natMap - **Type**: `NatMap` - **Optional**: Yes - **Description**: (No description provided) ### redisOptions - **Type**: `Omit` - **Optional**: Yes - **Description**: Passed to the constructor of `Redis`. - **Default**: `null` ### resolveSrv - **Type**: `DNSResolveSrvFunction` - **Optional**: Yes - **Description**: SRV records will be resolved via this function. You may provide a custom `resolveSrv` function when you want to customize the cache behavior of the default function. - **Default**: `require('dns').resolveSrv` ### retryDelayOnClusterDown - **Type**: `number` - **Optional**: Yes - **Description**: When a CLUSTERDOWN error is received, client will retry if `retryDelayOnClusterDown` is valid delay time (in ms). - **Default**: `100` ### retryDelayOnFailover - **Type**: `number` - **Optional**: Yes - **Description**: When an error is received when sending a command (e.g. "Connection is closed." when the target Redis node is down), client will retry if `retryDelayOnFailover` is valid delay time (in ms). - **Default**: `100` ``` -------------------------------- ### toString Source: https://redis.github.io/ioredis/classes/SentinelIterator.html Returns a string representation of the iterator. ```APIDOC ## toString() ### Description Returns a string representation of the iterator. ### Returns - **string** - The string representation. ``` -------------------------------- ### Default retryStrategy description Source: https://redis.github.io/ioredis/interfaces/CommonRedisOptions.html The default behavior for the retryStrategy option. ```text Exponential backoff capped at 5000ms, plus 0-199ms of random jitter. ``` -------------------------------- ### check(info) Source: https://redis.github.io/ioredis/classes/SentinelConnector.html Method to check the role information. ```APIDOC ## check(info) ### Description Checks the given info object and returns a boolean indicating whether the check passes. ### Method `check(info)` ### Parameters - **info** (object) - Required - An object containing role information. - **role** (string) - Optional - The role to check. ### Returns - **boolean** - The result of the check. ``` -------------------------------- ### add Source: https://redis.github.io/ioredis/classes/SentinelIterator.html Adds a sentinel to the iterator. ```APIDOC ## add(sentinel) ### Description Adds a sentinel to the iterator. ### Parameters - **sentinel** (SentinelAddress) - Required - The sentinel address to add. ### Returns - **boolean** - Whether the addition was successful. ``` -------------------------------- ### Default protocol value Source: https://redis.github.io/ioredis/interfaces/CommonRedisOptions.html The default value for the protocol option. ```text 3 ``` -------------------------------- ### transformReply(result) Source: https://redis.github.io/ioredis/classes/Command.html Converts buffer/buffer[] to string/string[], and applies reply transformer. ```APIDOC ## transformReply(result) ### Description Convert buffer/buffer[] to string/string[], and apply reply transformer. ### Method transformReply ### Parameters - **result** (Buffer | Buffer[]) - Required - The reply result. ### Returns - **string | string[] | Buffer | Buffer[]** - The transformed reply. ``` -------------------------------- ### StandaloneConnectionOptions Source: https://redis.github.io/ioredis/types/StandaloneConnectionOptions.html Type alias for standalone Redis connection options. It combines TCP and IPC options with optional disconnectTimeout and TLS settings. ```APIDOC ## StandaloneConnectionOptions ### Description Type alias for standalone Redis connection options. It combines TCP and IPC options with optional disconnectTimeout and TLS settings. ### Type Declaration - **disconnectTimeout** (number) - Optional - Timeout for disconnection in milliseconds. - **tls** (ConnectionOptions) - Optional - TLS connection options. ### Usage This type is used to configure a standalone Redis connection. It is a partial of TcpOptions and IpcOptions, meaning any TCP or IPC option can be provided, along with the additional properties. ``` -------------------------------- ### Default replyMapping value Source: https://redis.github.io/ioredis/interfaces/CommonRedisOptions.html The default value for the replyMapping option. ```text "legacy" ``` -------------------------------- ### SentinelConnectionOptions Interface Source: https://redis.github.io/ioredis/interfaces/SentinelConnectionOptions.html The SentinelConnectionOptions interface defines the configuration options for connecting to Redis Sentinel. It includes properties for timeouts, TLS, sentinel discovery, and failover behavior. ```APIDOC ## Interface SentinelConnectionOptions ### Description Configuration options for connecting to Redis Sentinel. ### Properties #### `Optional` connectTimeout - **Type**: number - **Description**: Connection timeout in milliseconds. #### `Optional` disconnectTimeout - **Type**: number - **Description**: Disconnect timeout in milliseconds. #### `Optional` enableTLSForSentinelMode - **Type**: boolean - **Description**: Enable TLS for Sentinel mode. #### `Optional` failoverDetector - **Type**: boolean - **Description**: Enable failover detection. #### `Optional` family - **Type**: number - **Description**: IP family (4 or 6). #### `Optional` name - **Type**: string - **Description**: Master group name of the Sentinel. #### `Optional` natMap - **Type**: NatMap - **Description**: NAT mapping for Sentinel addresses. #### `Optional` path - **Type**: string - **Description**: Unix socket path. #### `Optional` preferredSlaves - **Type**: PreferredSlaves - **Description**: Preferred slaves configuration. #### `Optional` protocol - **Type**: ProtocolVersion - **Description**: Protocol version. #### `Optional` replyMapping - **Type**: ReplyMappingMode - **Description**: Reply mapping mode. #### `Optional` role - **Type**: "master" | "slave" - **Default**: "master" - **Description**: Role of the connection. #### `Optional` sentinelCommandTimeout - **Type**: number - **Description**: Timeout for Sentinel commands. #### `Optional` sentinelMaxConnections - **Type**: number - **Default**: 10 - **Description**: Maximum number of Sentinel connections. #### `Optional` sentinelPassword - **Type**: string - **Description**: Password for Sentinel authentication. #### `Optional` sentinelReconnectStrategy - **Type**: (retryAttempts: number) => number | void - **Description**: Reconnect strategy for Sentinel connections. #### `Optional` sentinelRetryStrategy - **Type**: (retryAttempts: number) => number | void - **Description**: Retry strategy for Sentinel connections. #### `Optional` sentinelTLS - **Type**: ConnectionOptions - **Description**: TLS options for Sentinel connections. #### `Optional` sentinelUsername - **Type**: string - **Description**: Username for Sentinel authentication. #### `Optional` sentinels - **Type**: Partial[] - **Description**: List of Sentinel addresses. #### `Optional` tls - **Type**: ConnectionOptions - **Description**: TLS options for the main connection. #### `Optional` updateSentinels - **Type**: boolean - **Description**: Whether to update Sentinel list after failover. ``` -------------------------------- ### getSlot() Source: https://redis.github.io/ioredis/classes/Command.html Returns the slot number for the command. This is used for cluster routing. ```APIDOC ## getSlot() ### Description Returns the slot number for the command. ### Method getSlot ### Returns - **number** - The slot number. ``` -------------------------------- ### setTimeout(ms) Source: https://redis.github.io/ioredis/classes/Command.html Sets the wait time before terminating the attempt to execute a command and generating an error. ```APIDOC ## setTimeout(ms) ### Description Set the wait time before terminating the attempt to execute a command and generating an error. ### Method setTimeout ### Parameters - **ms** (number) - Required - The timeout in milliseconds. ### Returns - **void** ``` -------------------------------- ### Default maxLoadingRetryTime value Source: https://redis.github.io/ioredis/interfaces/CommonRedisOptions.html The default value for the maxLoadingRetryTime option. ```text 10000 ``` -------------------------------- ### reset Source: https://redis.github.io/ioredis/classes/SentinelIterator.html Resets the iterator to the beginning, optionally moving the current endpoint to the first position. ```APIDOC ## reset(moveCurrentEndpointToFirst) ### Description Resets the iterator to the beginning. ### Parameters - **moveCurrentEndpointToFirst** (boolean) - Required - Whether to move the current endpoint to the first position. ### Returns - **void** - No return value. ``` -------------------------------- ### Default scripts value Source: https://redis.github.io/ioredis/interfaces/CommonRedisOptions.html The default value for the scripts option. ```text undefined ``` -------------------------------- ### ScanStreamOptions Source: https://redis.github.io/ioredis/interfaces/ScanStreamOptions.html The ScanStreamOptions interface defines optional configuration properties for scan operations in ioredis, including count, match, noValues, and type. ```APIDOC ## ScanStreamOptions ### Description Options for configuring a scan stream in ioredis. ### Properties - **count** (number) - Optional - The number of elements to return per scan iteration. - **match** (string) - Optional - A glob-style pattern to filter keys. - **noValues** (boolean) - Optional - If true, only return keys without values. - **type** (string) - Optional - The type of keys to scan (e.g., 'string', 'list'). ``` -------------------------------- ### setBlockingTimeout(ms) Source: https://redis.github.io/ioredis/classes/Command.html Sets a timeout for blocking commands. When the timeout expires, the command resolves with null (matching Redis behavior). This handles undetectable network failures. ```APIDOC ## setBlockingTimeout(ms) ### Description Set a timeout for blocking commands. When the timeout expires, the command resolves with null (matching Redis behavior). This handles the case of undetectable network failures (e.g., docker network disconnect) where the TCP connection becomes a zombie and no close event fires. ### Method setBlockingTimeout ### Parameters - **ms** (number) - Required - The timeout in milliseconds. ### Returns - **void** ``` -------------------------------- ### Default noDelay value Source: https://redis.github.io/ioredis/interfaces/CommonRedisOptions.html The default value for the noDelay option. ```text true ``` -------------------------------- ### Callback Source: https://redis.github.io/ioredis/types/Callback.html Defines a generic callback function type used in ioredis for asynchronous operations. The callback receives an optional error and an optional result, and returns void. ```APIDOC ## Callback ### Description Defines a generic callback function type used in ioredis for asynchronous operations. The callback receives an optional error and an optional result, and returns void. ### Type Parameters - **T** (default: any) - The type of the result passed to the callback. ### Signature typescript Callback: ((err?: Error | null, result?: T) => void) ### Parameters - **err** (Error | null) - Optional. The error object, if any. - **result** (T) - Optional. The result value of type T. ### Returns - **void** - The callback does not return a value. ``` -------------------------------- ### extractBlockingTimeout() Source: https://redis.github.io/ioredis/classes/Command.html Extracts the blocking timeout from the command arguments. Returns the timeout in seconds, null for indefinite blocking (timeout of 0), or undefined if this is not a blocking command. ```APIDOC ## extractBlockingTimeout() ### Description Extracts the blocking timeout from the command arguments. ### Method extractBlockingTimeout ### Returns - **number** - The timeout in seconds, null for indefinite blocking (timeout of 0), or undefined if this is not a blocking command. ``` -------------------------------- ### Default autoPipeliningIgnoredCommands Source: https://redis.github.io/ioredis/interfaces/ClusterOptions.html The default value for autoPipeliningIgnoredCommands. ```javascript [] ``` -------------------------------- ### stringifyArguments() Source: https://redis.github.io/ioredis/classes/Command.html Stringifies the command arguments. This method is used to convert arguments to a string representation. ```APIDOC ## stringifyArguments() ### Description Stringifies the command arguments. ### Method stringifyArguments ### Returns - **void** ``` -------------------------------- ### DNSLookupFunction Source: https://redis.github.io/ioredis/types/DNSLookupFunction.html Type alias for a custom DNS lookup function. It takes a hostname and a callback, and returns void. ```APIDOC ## DNSLookupFunction ### Description Type alias for a custom DNS lookup function. It defines a function that takes a hostname and a callback, and returns void. ### Type Declaration ```typescript DNSLookupFunction: ((hostname: string, callback: (err: NodeJS.ErrnoException | null | undefined, address: string, family?: number) => void) => void) ``` ### Parameters - **hostname** (string) - The hostname to resolve. - **callback** (function) - Callback function invoked with the result. - **err** (NodeJS.ErrnoException | null | undefined) - Error object if resolution failed, otherwise null or undefined. - **address** (string) - The resolved IP address. - **family** (number, optional) - The IP family (e.g., 4 or 6). ### Returns void ``` -------------------------------- ### checkFlag(flagName, commandName) Source: https://redis.github.io/ioredis/classes/Command.html Checks whether the command has the specified flag. This is a static method. ```APIDOC ## checkFlag(flagName, commandName) ### Description Check whether the command has the flag. ### Method checkFlag ### Type Parameters - **T** extends keyof CommandNameFlags ### Parameters - **flagName** (T) - Required - The flag name. - **commandName** (string) - Required - The command name. ### Returns - **commandName is CommandNameFlags[T][number]** - Type predicate indicating whether the command has the flag. ``` -------------------------------- ### SentinelAddress Interface Source: https://redis.github.io/ioredis/interfaces/SentinelAddress.html Defines the shape of a Sentinel address object used in ioredis. It includes the host and port properties, and an optional family property. ```APIDOC ## SentinelAddress Interface ### Description Represents the address of a Redis Sentinel node. ### Properties - **family** (number) - Optional - The IP family (e.g., 4 or 6). - **host** (string) - Required - The hostname or IP address of the Sentinel. - **port** (number) - Required - The port number of the Sentinel. ``` -------------------------------- ### setReplyTransformer(name, func) Source: https://redis.github.io/ioredis/classes/Command.html Sets a reply transformer for a command. This is a static method. ```APIDOC ## setReplyTransformer(name, func) ### Description Sets a reply transformer for a command. ### Method setReplyTransformer ### Parameters - **name** (string) - Required - The command name. - **func** (ReplyTransformer) - Required - The transformer function. ### Returns - **void** ``` -------------------------------- ### Default maxRetriesPerRequest value Source: https://redis.github.io/ioredis/interfaces/CommonRedisOptions.html The default value for the maxRetriesPerRequest option. ```text 20 ``` -------------------------------- ### Default maxRedirections Source: https://redis.github.io/ioredis/interfaces/ClusterOptions.html The default value for maxRedirections. ```javascript 16 ``` -------------------------------- ### Default lazyConnect value Source: https://redis.github.io/ioredis/interfaces/CommonRedisOptions.html The default value for the lazyConnect option. ```text false ``` -------------------------------- ### DNSResolveSrvFunction Source: https://redis.github.io/ioredis/types/DNSResolveSrvFunction.html Type alias for a DNS SRV resolution function. It accepts a hostname and a callback, and returns void. The callback is called with an error (if any) and optionally an array of SRV records. ```APIDOC ## DNSResolveSrvFunction ### Description Type alias for a function that resolves DNS SRV records. It takes a hostname and a callback, and returns void. ### Type Declaration ```typescript DNSResolveSrvFunction: ((hostname: string, callback: (err: NodeJS.ErrnoException | null | undefined, records?: SrvRecord[]) => void) => void) ``` ### Parameters - **hostname** (string) - Required - The hostname to resolve SRV records for. - **callback** (function) - Required - Callback function invoked with the result. - **err** (NodeJS.ErrnoException | null | undefined) - Required - Error object if resolution failed, otherwise null or undefined. - **records** (SrvRecord[]) - Optional - Array of SRV records if resolution succeeded. ### Returns - **void** - The function returns nothing. ``` -------------------------------- ### Default dnsLookup Source: https://redis.github.io/ioredis/interfaces/ClusterOptions.html The default function used for DNS lookup. ```javascript require('dns').lookup ``` -------------------------------- ### disconnect() Source: https://redis.github.io/ioredis/classes/SentinelConnector.html Method to disconnect the connector. ```APIDOC ## disconnect() ### Description Disconnects the connector. ### Method `disconnect()` ### Parameters None. ### Returns - **void** - No return value. ``` -------------------------------- ### Default reconnectOnError value Source: https://redis.github.io/ioredis/interfaces/CommonRedisOptions.html The default value for the reconnectOnError option. ```text null ``` -------------------------------- ### Default himportFieldsets Source: https://redis.github.io/ioredis/interfaces/ClusterOptions.html The default value for himportFieldsets. ```javascript undefined @experimental ``` -------------------------------- ### setArgumentTransformer(name, func) Source: https://redis.github.io/ioredis/classes/Command.html Sets an argument transformer for a command. This is a static method. ```APIDOC ## setArgumentTransformer(name, func) ### Description Sets an argument transformer for a command. ### Method setArgumentTransformer ### Parameters - **name** (string) - Required - The command name. - **func** (ArgumentTransformer) - Required - The transformer function. ### Returns - **void** ``` -------------------------------- ### HimportFieldset Source: https://redis.github.io/ioredis/interfaces/HimportFieldset.html The HimportFieldset interface represents a long-lived HIMPORT fieldset managed by ioredis. It contains the field names and the name used for HIMPORT SET commands. ```APIDOC ## HimportFieldset ### Description The HimportFieldset interface represents a long-lived HIMPORT fieldset managed by ioredis for the lifetime of a logical Redis or Cluster client. It requires Redis 8.10 or newer. ### Properties #### fields - Type: readonly (string | Buffer)[] - Readonly - Ordered hash field names. Values passed to HIMPORT SET are paired with fields positionally. #### name - Type: string | Buffer - Readonly - The name referenced by later HIMPORT SET commands. ``` -------------------------------- ### Default clusterRetryStrategy Source: https://redis.github.io/ioredis/interfaces/ClusterOptions.html The default value for clusterRetryStrategy. ```javascript (times) => Math.min(100 + times * 2, 2000) ``` -------------------------------- ### Default resolveSrv Source: https://redis.github.io/ioredis/interfaces/ClusterOptions.html The default function used for resolving SRV records. ```javascript require('dns').resolveSrv ``` -------------------------------- ### Default retryDelayOnClusterDown Source: https://redis.github.io/ioredis/interfaces/ClusterOptions.html The default value for retryDelayOnClusterDown. ```javascript 100 ``` -------------------------------- ### ClusterNode Type Alias Source: https://redis.github.io/ioredis/types/ClusterNode.html Defines the ClusterNode type alias, which can be a string, a number, or an object with optional host and port properties. This type is used to specify cluster nodes in ioredis cluster configuration. ```APIDOC ## ClusterNode Type Alias ### Description Represents a node in a Redis Cluster. It can be a string (hostname), a number (port), or an object with optional host and port properties. ### Type Definition ```typescript type ClusterNode = string | number | { host?: string; port?: number; }; ``` ### Properties - **host** (string) - Optional - The hostname or IP address of the cluster node. - **port** (number) - Optional - The port number of the cluster node. ### Usage This type is used when configuring an ioredis cluster client to specify the nodes that form the cluster. ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.