Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface CommonRedisOptions

Hierarchy

  • CommanderOptions
    • CommonRedisOptions

Index

Properties

Connector?: ConnectorConstructor
autoPipeliningIgnoredCommands?: string[]
default

[]

autoResendUnfulfilledCommands?: 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

autoResubscribe?: boolean
default

true

commandQueue?: boolean
commandTimeout?: number
connectTimeout?: number
default

10000

connectionName?: string

Set the name of the connection to make it easier to identity the connection in client list.

link

https://redis.io/commands/client-setname

db?: number
default

0

enableAutoPipelining?: boolean
default

false

enableOfflineQueue?: boolean
default

true

enableReadyCheck?: boolean
default

true

keepAlive?: number

Enable/disable keep-alive functionality.

link

https://nodejs.org/api/net.html#socketsetkeepaliveenable-initialdelay

default

0

keyPrefix?: string
lazyConnect?: boolean
default

false

maxLoadingRetryTime?: number
default

10000

maxRetriesPerRequest?: number
default

20

monitor?: boolean
default

false

noDelay?: boolean

Enable/disable the use of Nagle's algorithm.

link

https://nodejs.org/api/net.html#socketsetnodelaynodelay

default

true

offlineQueue?: boolean
password?: string
readOnly?: boolean
default

false

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
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

scripts?: Record<string, { lua: string; numberOfKeys?: number; readOnly?: boolean }>
default

undefined

showFriendlyErrorStack?: boolean
stringNumbers?: 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

username?: string

Methods

  • retryStrategy(times: number): number | void

Generated using TypeDoc