@@ -8,35 +8,58 @@ export type ReconnectOnError = (err: Error) => boolean | 1 | 2;
8
8
export interface CommonRedisOptions extends CommanderOptions {
9
9
Connector ?: ConnectorConstructor ;
10
10
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
+ */
11
16
commandTimeout ?: number ;
12
17
/**
13
18
* Enable/disable keep-alive functionality.
14
19
* @link https://nodejs.org/api/net.html#socketsetkeepaliveenable-initialdelay
15
20
* @default 0
16
21
*/
17
22
keepAlive ?: number ;
23
+
18
24
/**
19
25
* Enable/disable the use of Nagle's algorithm.
20
26
* @link https://nodejs.org/api/net.html#socketsetnodelaynodelay
21
27
* @default true
22
28
*/
23
29
noDelay ?: boolean ;
30
+
24
31
/**
25
32
* Set the name of the connection to make it easier to identity the connection
26
33
* in client list.
27
34
* @link https://redis.io/commands/client-setname
28
35
*/
29
36
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
+ */
30
42
username ?: string ;
43
+
44
+ /**
45
+ * If set, client will send AUTH command with the value of this option when connected.
46
+ */
31
47
password ?: string ;
48
+
32
49
/**
50
+ * Database index to use.
51
+ *
33
52
* @default 0
34
53
*/
35
54
db ?: number ;
55
+
36
56
/**
57
+ * When the client reconnects, channels subscribed in the previous connection will be
58
+ * resubscribed automatically if `autoResubscribe` is `true`.
37
59
* @default true
38
60
*/
39
61
autoResubscribe ?: boolean ;
62
+
40
63
/**
41
64
* Whether or not to resend unfulfilled commands on reconnect.
42
65
* Unfulfilled commands are most likely to be blocking commands such as `brpop` or `blpop`.
@@ -65,6 +88,7 @@ export interface CommonRedisOptions extends CommanderOptions {
65
88
* @default null
66
89
*/
67
90
reconnectOnError ?: ReconnectOnError | null ;
91
+
68
92
/**
69
93
* @default false
70
94
*/
@@ -75,18 +99,33 @@ export interface CommonRedisOptions extends CommanderOptions {
75
99
* @default false
76
100
*/
77
101
stringNumbers ?: boolean ;
102
+
78
103
/**
104
+ * How long the client will wait before killing a socket due to inactivity during initial connection.
79
105
* @default 10000
80
106
*/
81
107
connectTimeout ?: number ;
108
+
82
109
/**
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
+ *
83
113
* @default false
84
114
*/
85
115
monitor ?: boolean ;
116
+
86
117
/**
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
+ *
87
125
* @default 20
88
126
*/
89
127
maxRetriesPerRequest ?: number | null ;
128
+
90
129
/**
91
130
* @default 10000
92
131
*/
@@ -101,18 +140,38 @@ export interface CommonRedisOptions extends CommanderOptions {
101
140
autoPipeliningIgnoredCommands ?: string [ ] ;
102
141
offlineQueue ?: boolean ;
103
142
commandQueue ?: boolean ;
143
+
104
144
/**
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
+ *
105
152
* @default true
106
153
*/
107
154
enableOfflineQueue ?: boolean ;
155
+
108
156
/**
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
+ *
109
161
* @default true
110
162
*/
111
163
enableReadyCheck ?: boolean ;
164
+
112
165
/**
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
+ *
113
170
* @default false
114
171
*/
172
+
115
173
lazyConnect ?: boolean ;
174
+
116
175
/**
117
176
* @default undefined
118
177
*/
0 commit comments