@@ -8,35 +8,58 @@ export type ReconnectOnError = (err: Error) => boolean | 1 | 2;
88export interface CommonRedisOptions extends CommanderOptions {
99 Connector ?: ConnectorConstructor ;
1010 retryStrategy ?: ( times : number ) => number | void | null ;
11+
12+ /**
13+ * If a command does not return a reply within a set number of milliseconds,
14+ * a "Command timed out" error will be thrown.
15+ */
1116 commandTimeout ?: number ;
1217 /**
1318 * Enable/disable keep-alive functionality.
1419 * @link https://nodejs.org/api/net.html#socketsetkeepaliveenable-initialdelay
1520 * @default 0
1621 */
1722 keepAlive ?: number ;
23+
1824 /**
1925 * Enable/disable the use of Nagle's algorithm.
2026 * @link https://nodejs.org/api/net.html#socketsetnodelaynodelay
2127 * @default true
2228 */
2329 noDelay ?: boolean ;
30+
2431 /**
2532 * Set the name of the connection to make it easier to identity the connection
2633 * in client list.
2734 * @link https://redis.io/commands/client-setname
2835 */
2936 connectionName ?: string ;
37+
38+ /**
39+ * If set, client will send AUTH command with the value of this option as the first argument when connected.
40+ * This is supported since Redis 6.
41+ */
3042 username ?: string ;
43+
44+ /**
45+ * If set, client will send AUTH command with the value of this option when connected.
46+ */
3147 password ?: string ;
48+
3249 /**
50+ * Database index to use.
51+ *
3352 * @default 0
3453 */
3554 db ?: number ;
55+
3656 /**
57+ * When the client reconnects, channels subscribed in the previous connection will be
58+ * resubscribed automatically if `autoResubscribe` is `true`.
3759 * @default true
3860 */
3961 autoResubscribe ?: boolean ;
62+
4063 /**
4164 * Whether or not to resend unfulfilled commands on reconnect.
4265 * Unfulfilled commands are most likely to be blocking commands such as `brpop` or `blpop`.
@@ -65,6 +88,7 @@ export interface CommonRedisOptions extends CommanderOptions {
6588 * @default null
6689 */
6790 reconnectOnError ?: ReconnectOnError | null ;
91+
6892 /**
6993 * @default false
7094 */
@@ -75,18 +99,33 @@ export interface CommonRedisOptions extends CommanderOptions {
7599 * @default false
76100 */
77101 stringNumbers ?: boolean ;
102+
78103 /**
104+ * How long the client will wait before killing a socket due to inactivity during initial connection.
79105 * @default 10000
80106 */
81107 connectTimeout ?: number ;
108+
82109 /**
110+ * This option is used internally when you call `redis.monitor()` to tell Redis
111+ * to enter the monitor mode when the connection is established.
112+ *
83113 * @default false
84114 */
85115 monitor ?: boolean ;
116+
86117 /**
118+ * The commands that don't get a reply due to the connection to the server is lost are
119+ * put into a queue and will be resent on reconnect (if allowed by the `retryStrategy` option).
120+ * This option is used to configure how many reconnection attempts should be allowed before
121+ * the queue is flushed with a `MaxRetriesPerRequestError` error.
122+ * Set this options to `null` instead of a number to let commands wait forever
123+ * until the connection is alive again.
124+ *
87125 * @default 20
88126 */
89127 maxRetriesPerRequest ?: number | null ;
128+
90129 /**
91130 * @default 10000
92131 */
@@ -101,18 +140,38 @@ export interface CommonRedisOptions extends CommanderOptions {
101140 autoPipeliningIgnoredCommands ?: string [ ] ;
102141 offlineQueue ?: boolean ;
103142 commandQueue ?: boolean ;
143+
104144 /**
145+ *
146+ * By default, if the connection to Redis server has not been established, commands are added to a queue
147+ * and are executed once the connection is "ready" (when `enableReadyCheck` is true, "ready" means
148+ * the Redis server has loaded the database from disk, otherwise means the connection to the Redis
149+ * server has been established). If this option is false, when execute the command when the connection
150+ * isn't ready, an error will be returned.
151+ *
105152 * @default true
106153 */
107154 enableOfflineQueue ?: boolean ;
155+
108156 /**
157+ * The client will sent an INFO command to check whether the server is still loading data from the disk (
158+ * which happens when the server is just launched) when the connection is established, and only wait until
159+ * the loading process is finished before emitting the `ready` event.
160+ *
109161 * @default true
110162 */
111163 enableReadyCheck ?: boolean ;
164+
112165 /**
166+ * When a Redis instance is initialized, a connection to the server is immediately established. Set this to
167+ * true will delay the connection to the server until the first command is sent or `redis.connect()` is called
168+ * explicitly.
169+ *
113170 * @default false
114171 */
172+
115173 lazyConnect ?: boolean ;
174+
116175 /**
117176 * @default undefined
118177 */
0 commit comments