1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 |
|
24 |
|
25 |
|
26 |
|
27 |
|
28 |
|
29 | import { ConnectionOptions } from 'tls';
|
30 | import { Readable } from 'stream';
|
31 | import { EventEmitter } from 'events';
|
32 |
|
33 | interface RedisStatic {
|
34 | new (port?: number, host?: string, options?: IORedis.RedisOptions): IORedis.Redis;
|
35 | new (host?: string, options?: IORedis.RedisOptions): IORedis.Redis;
|
36 | new (options?: IORedis.RedisOptions): IORedis.Redis;
|
37 | (port?: number, host?: string, options?: IORedis.RedisOptions): IORedis.Redis;
|
38 | (host?: string, options?: IORedis.RedisOptions): IORedis.Redis;
|
39 | (options?: IORedis.RedisOptions): IORedis.Redis;
|
40 | Cluster: IORedis.ClusterStatic;
|
41 | Command: typeof Command;
|
42 | }
|
43 |
|
44 | declare var IORedis: RedisStatic;
|
45 | export = IORedis;
|
46 |
|
47 | declare class Commander {
|
48 | getBuiltinCommands(): string[];
|
49 | createBuiltinCommand(commandName: string): {};
|
50 | defineCommand(
|
51 | name: string,
|
52 | definition: {
|
53 | numberOfKeys?: number;
|
54 | lua?: string;
|
55 | },
|
56 | ): void;
|
57 | sendCommand(): void;
|
58 | }
|
59 |
|
60 | interface CommandOptions {
|
61 | replyEncoding?: string | null;
|
62 | errorStack?: string;
|
63 | keyPrefix?: string;
|
64 | }
|
65 | declare class Command {
|
66 | isCustomCommand: boolean;
|
67 | args: IORedis.ValueType[];
|
68 | getSlot(): number | null;
|
69 | getKeys(): Array<string | Buffer>;
|
70 | constructor(
|
71 | name: string,
|
72 | args: IORedis.ValueType[],
|
73 | opts?: CommandOptions,
|
74 | callback?: (err: null, result: any) => void,
|
75 | );
|
76 | static setArgumentTransformer(name: string, fn: (args: IORedis.ValueType[]) => IORedis.ValueType[]): void;
|
77 | static setReplyTransformer(name: string, fn: (result: any) => any): void;
|
78 | }
|
79 |
|
80 | // For backwards compatibility
|
81 | type _Command = typeof Command;
|
82 |
|
83 | declare namespace IORedis {
|
84 | type BooleanResponse = 1 | 0;
|
85 | type Callback<T> = (err: Error | null, res: T) => void;
|
86 | type KeyType = string | Buffer;
|
87 | type ValueType = string | Buffer | number | any[];
|
88 |
|
89 | interface OverloadedCommand<T, U> {
|
90 | (arg1: T, arg2: T, arg3: T, arg4: T, arg5: T, arg6: T, cb: Callback<U>): void;
|
91 | (arg1: T, arg2: T, arg3: T, arg4: T, arg5: T, cb: Callback<U>): void;
|
92 | (arg1: T, arg2: T, arg3: T, arg4: T, cb: Callback<U>): void;
|
93 | (arg1: T, arg2: T, arg3: T, cb: Callback<U>): void;
|
94 | (arg1: T, arg2: T, cb: Callback<U>): void;
|
95 | (arg1: T | T[], cb: Callback<U>): void;
|
96 | (cb: Callback<U>): void;
|
97 | (...args: T[]): Promise<U>;
|
98 | (arg1: T[]): Promise<U>;
|
99 | }
|
100 |
|
101 | interface OverloadedListCommand<T, U> {
|
102 | (arg1: T, arg2: T, arg3: T, arg4: T, arg5: T, arg6: T, cb: Callback<U>): void;
|
103 | (arg1: T, arg2: T, arg3: T, arg4: T, arg5: T, cb: Callback<U>): void;
|
104 | (arg1: T, arg2: T, arg3: T, arg4: T, cb: Callback<U>): void;
|
105 | (arg1: T, arg2: T, arg3: T, cb: Callback<U>): void;
|
106 | (arg1: T, arg2: T, cb: Callback<U>): void;
|
107 | (arg1: T | T[], cb: Callback<U>): void;
|
108 | (...args: T[]): Promise<U>;
|
109 | (arg1: T[]): Promise<U>;
|
110 | }
|
111 |
|
112 | interface OverloadedBlockingListCommand<T, U> {
|
113 | (arg1: T, arg2: T, arg3: T, arg4: T, arg5: T, arg6: T, timeout: number, cb: Callback<U>): void;
|
114 | (arg1: T, arg2: T, arg3: T, arg4: T, arg5: T, timeout: number, cb: Callback<U>): void;
|
115 | (arg1: T, arg2: T, arg3: T, arg4: T, timeout: number, cb: Callback<U>): void;
|
116 | (arg1: T, arg2: T, arg3: T, timeout: number, cb: Callback<U>): void;
|
117 | (arg1: T, arg2: T, timeout: number, cb: Callback<U>): void;
|
118 | (arg1: T, timeout: number, cb: Callback<U>): void;
|
119 | (arg1: Array<T | number>, cb: Callback<U>): void;
|
120 | (arg1: T, arg2: T, arg3: T, arg4: T, arg5: T, arg6: T, timeout: number): Promise<U>;
|
121 | (arg1: T, arg2: T, arg3: T, arg4: T, arg5: T, timeout: number): Promise<U>;
|
122 | (arg1: T, arg2: T, arg3: T, arg4: T, timeout: number): Promise<U>;
|
123 | (arg1: T, arg2: T, arg3: T, timeout: number): Promise<U>;
|
124 | (arg1: T, arg2: T, timeout: number): Promise<U>;
|
125 | (arg1: T, timeout: number): Promise<U>;
|
126 | (arg1: Array<T | number>): Promise<U>;
|
127 | (...args: Array<T | number>): Promise<U>;
|
128 | }
|
129 |
|
130 | interface OverloadedSubCommand<T, U> {
|
131 | (arg1: T, arg2: T, arg3: T, arg4: T, arg5: T, arg6: T, cb: Callback<U>): void;
|
132 | (arg1: T, arg2: T, arg3: T, arg4: T, arg5: T, cb: Callback<U>): void;
|
133 | (arg1: T, arg2: T, arg3: T, arg4: T, cb: Callback<U>): void;
|
134 | (arg1: T, arg2: T, arg3: T, cb: Callback<U>): void;
|
135 | (arg1: T, arg2: T | T[], cb: Callback<U>): void;
|
136 | (arg1: T | T[], cb: Callback<U>): void;
|
137 | (...args: T[]): Promise<U>;
|
138 | (arg1: T[]): Promise<U>;
|
139 | }
|
140 |
|
141 | interface OverloadedKeyCommand<T, U> {
|
142 | (key: KeyType, arg1: T, arg2: T, arg3: T, arg4: T, arg5: T, arg6: T, cb: Callback<U>): void;
|
143 | (key: KeyType, arg1: T, arg2: T, arg3: T, arg4: T, arg5: T, cb: Callback<U>): void;
|
144 | (key: KeyType, arg1: T, arg2: T, arg3: T, arg4: T, cb: Callback<U>): void;
|
145 | (key: KeyType, arg1: T, arg2: T, arg3: T, cb: Callback<U>): void;
|
146 | (key: KeyType, arg1: T, arg2: T, cb: Callback<U>): void;
|
147 | (key: KeyType, arg1: T | T[], cb: Callback<U>): void;
|
148 | (key: KeyType, ...args: T[]): Promise<U>;
|
149 | (key: KeyType, arg1: T[]): Promise<U>;
|
150 | }
|
151 |
|
152 | interface OverloadedHashCommand<T, U> {
|
153 | (arg1: T, arg2: T, arg3: T, arg4: T, arg5: T, arg6: T, cb: Callback<U>): void;
|
154 | (arg1: T, arg2: T, arg3: T, arg4: T, cb: Callback<U>): void;
|
155 | (arg1: T, arg2: T, cb: Callback<U>): void;
|
156 | (data: T[] | { [key: string]: T } | Map<string, T>, cb: Callback<U>): void;
|
157 | (data: T[] | { [key: string]: T } | Map<string, T>): Promise<U>;
|
158 | (...args: T[]): Promise<U>;
|
159 | }
|
160 |
|
161 | interface OverloadedKeyedHashCommand<T, U> {
|
162 | (key: KeyType, arg1: T, arg2: T, arg3: T, arg4: T, arg5: T, arg6: T, cb: Callback<U>): void;
|
163 | (key: KeyType, arg1: T, arg2: T, arg3: T, arg4: T, cb: Callback<U>): void;
|
164 | (key: KeyType, arg1: T, arg2: T, cb: Callback<U>): void;
|
165 | (key: KeyType, data: T[] | { [key: string]: T } | Map<string, ValueType>, cb: Callback<U>): void;
|
166 | (key: KeyType, data: T[] | { [key: string]: T } | Map<string, ValueType>): Promise<U>;
|
167 | (key: KeyType, ...args: T[]): Promise<U>;
|
168 | }
|
169 |
|
170 | interface OverloadedEvalCommand<T, U> {
|
171 | (script: string, numKeys: number, arg1: T, arg2: T, arg3: T, arg4: T, arg5: T, arg6: T, cb: Callback<U>): void;
|
172 | (script: string, numKeys: number, arg1: T, arg2: T, arg3: T, arg4: T, arg5: T, cb: Callback<U>): void;
|
173 | (script: string, numKeys: number, arg1: T, arg2: T, arg3: T, arg4: T, cb: Callback<U>): void;
|
174 | (script: string, numKeys: number, arg1: T, arg2: T, arg3: T, cb: Callback<U>): void;
|
175 | (script: string, numKeys: number, arg1: T, arg2: T, cb: Callback<U>): void;
|
176 | (script: string, numKeys: number, arg1: T | T[], cb: Callback<U>): void;
|
177 | (script: string, numKeys: number, ...args: T[]): Promise<U>;
|
178 | (script: string, numKeys: number, arg1: T[]): Promise<U>;
|
179 |
|
180 |
|
181 |
|
182 | (args: ValueType[], callback?: Callback<any>): any;
|
183 | }
|
184 |
|
185 | interface OverloadedScanCommand<T, U> {
|
186 | (key: string, cursor: number, arg1: T, arg2: T, arg3: T, arg4: T, arg5: T, arg6: T, cb: Callback<U>): void;
|
187 | (key: string, cursor: number, arg1: T, arg2: T, arg3: T, arg4: T, arg5: T, cb: Callback<U>): void;
|
188 | (key: string, cursor: number, arg1: T, arg2: T, arg3: T, arg4: T, cb: Callback<U>): void;
|
189 | (key: string, cursor: number, arg1: T, arg2: T, arg3: T, cb: Callback<U>): void;
|
190 | (key: string, cursor: number, arg1: T, arg2: T, cb: Callback<U>): void;
|
191 | (key: string, cursor: number, arg1: T | T[], cb: Callback<U>): void;
|
192 | (key: string, cursor: number, cb: Callback<U>): void;
|
193 | (key: string, cursor: number, ...args: T[]): Promise<U>;
|
194 | (key: string, cursor: number, arg1: T[]): Promise<U>;
|
195 | }
|
196 |
|
197 | type Command = _Command;
|
198 |
|
199 | interface Commands {
|
200 | bitcount(key: KeyType, callback: Callback<number>): void;
|
201 | bitcount(key: KeyType, start: number, end: number, callback: (err: Error, res: number) => void): void;
|
202 | bitcount(key: KeyType): Promise<number>;
|
203 | bitcount(key: KeyType, start: number, end: number): Promise<number>;
|
204 |
|
205 | get(key: KeyType, callback: Callback<string | null>): void;
|
206 | get(key: KeyType): Promise<string | null>;
|
207 |
|
208 | getBuffer(key: KeyType, callback: Callback<Buffer>): void;
|
209 | getBuffer(key: KeyType): Promise<Buffer>;
|
210 |
|
211 | set(
|
212 | key: KeyType,
|
213 | value: ValueType,
|
214 | expiryMode?: string | any[],
|
215 | time?: number | string,
|
216 | setMode?: number | string,
|
217 | ): Promise<Ok | null>;
|
218 |
|
219 | set(key: KeyType, value: ValueType, callback: Callback<Ok>): void;
|
220 | set(key: KeyType, value: ValueType, setMode: string | any[], callback: Callback<Ok | null>): void;
|
221 | set(key: KeyType, value: ValueType, expiryMode: string, time: number | string, callback: Callback<Ok>): void;
|
222 | set(
|
223 | key: KeyType,
|
224 | value: ValueType,
|
225 | expiryMode: string,
|
226 | time: number | string,
|
227 | setMode: number | string,
|
228 | callback: Callback<Ok | null>,
|
229 | ): void;
|
230 |
|
231 | setBuffer(
|
232 | key: KeyType,
|
233 | value: ValueType,
|
234 | expiryMode?: string | any[],
|
235 | time?: number | string,
|
236 | setMode?: number | string,
|
237 | ): Promise<Buffer>;
|
238 |
|
239 | setBuffer(key: KeyType, value: ValueType, callback: Callback<Buffer>): void;
|
240 | setBuffer(key: KeyType, value: ValueType, setMode: string, callback: Callback<Buffer>): void;
|
241 | setBuffer(key: KeyType, value: ValueType, expiryMode: string, time: number, callback: Callback<Buffer>): void;
|
242 | setBuffer(
|
243 | key: KeyType,
|
244 | value: ValueType,
|
245 | expiryMode: string,
|
246 | time: number | string,
|
247 | setMode: number | string,
|
248 | callback: Callback<Buffer>,
|
249 | ): void;
|
250 |
|
251 | setnx(key: KeyType, value: ValueType, callback: Callback<BooleanResponse>): void;
|
252 | setnx(key: KeyType, value: ValueType): Promise<BooleanResponse>;
|
253 |
|
254 | setex(key: KeyType, seconds: number, value: ValueType, callback: Callback<Ok>): void;
|
255 | setex(key: KeyType, seconds: number, value: ValueType): Promise<Ok>;
|
256 |
|
257 | psetex(key: KeyType, milliseconds: number, value: ValueType, callback: Callback<Ok>): void;
|
258 | psetex(key: KeyType, milliseconds: number, value: ValueType): Promise<Ok>;
|
259 |
|
260 | append(key: KeyType, value: ValueType, callback: Callback<number>): void;
|
261 | append(key: KeyType, value: ValueType): Promise<number>;
|
262 |
|
263 | strlen(key: KeyType, callback: Callback<number>): void;
|
264 | strlen(key: KeyType): Promise<number>;
|
265 |
|
266 | del: OverloadedListCommand<KeyType, number>;
|
267 |
|
268 | unlink: OverloadedListCommand<KeyType, number>;
|
269 |
|
270 | exists(...keys: KeyType[]): Promise<number>;
|
271 | exists(key: KeyType, callback: Callback<number>): void;
|
272 |
|
273 | setbit(key: KeyType, offset: number, value: ValueType, callback: Callback<number>): void;
|
274 | setbit(key: KeyType, offset: number, value: ValueType): Promise<number>;
|
275 |
|
276 | getbit(key: KeyType, offset: number, callback: Callback<number>): void;
|
277 | getbit(key: KeyType, offset: number): Promise<number>;
|
278 |
|
279 | setrange(key: KeyType, offset: number, value: ValueType, callback: Callback<number>): void;
|
280 | setrange(key: KeyType, offset: number, value: ValueType): Promise<number>;
|
281 |
|
282 | getrange(key: KeyType, start: number, end: number, callback: Callback<string>): void;
|
283 | getrange(key: KeyType, start: number, end: number): Promise<string>;
|
284 |
|
285 | getrangeBuffer(key: KeyType, start: number, end: number, callback: Callback<Buffer>): void;
|
286 | getrangeBuffer(key: KeyType, start: number, end: number): Promise<Buffer>;
|
287 |
|
288 | substr(key: KeyType, start: number, end: number, callback: Callback<string>): void;
|
289 | substr(key: KeyType, start: number, end: number): Promise<string>;
|
290 |
|
291 | incr(key: KeyType, callback: Callback<number>): void;
|
292 | incr(key: KeyType): Promise<number>;
|
293 |
|
294 | decr(key: KeyType, callback: Callback<number>): void;
|
295 | decr(key: KeyType): Promise<number>;
|
296 |
|
297 | mget: OverloadedListCommand<KeyType, Array<string | null>>;
|
298 |
|
299 | rpush: OverloadedKeyCommand<ValueType, number>;
|
300 | rpushBuffer: OverloadedKeyCommand<Buffer, number>;
|
301 |
|
302 | lpush: OverloadedKeyCommand<ValueType, number>;
|
303 | lpushBuffer: OverloadedKeyCommand<Buffer, number>;
|
304 |
|
305 | rpushx: OverloadedKeyCommand<ValueType, number>;
|
306 |
|
307 | lpushx: OverloadedKeyCommand<ValueType, number>;
|
308 |
|
309 | linsert(
|
310 | key: KeyType,
|
311 | direction: 'BEFORE' | 'AFTER',
|
312 | pivot: string,
|
313 | value: ValueType,
|
314 | callback: Callback<number>,
|
315 | ): void;
|
316 | linsert(key: KeyType, direction: 'BEFORE' | 'AFTER', pivot: string, value: ValueType): Promise<number>;
|
317 |
|
318 | rpop(key: KeyType, callback: Callback<string>): void;
|
319 | rpop(key: KeyType): Promise<string>;
|
320 |
|
321 | lpop(key: KeyType, callback: Callback<string>): void;
|
322 | lpop(key: KeyType): Promise<string>;
|
323 |
|
324 | lpopBuffer(key: KeyType, callback: Callback<Buffer>): void;
|
325 | lpopBuffer(key: KeyType): Promise<Buffer>;
|
326 |
|
327 | brpop: OverloadedBlockingListCommand<KeyType, [string, string]>;
|
328 |
|
329 | blpop: OverloadedBlockingListCommand<KeyType, [string, string]>;
|
330 |
|
331 | brpoplpush(source: string, destination: string, timeout: number, callback: Callback<string>): void;
|
332 | brpoplpush(source: string, destination: string, timeout: number): Promise<string>;
|
333 |
|
334 | llen(key: KeyType, callback: Callback<number>): void;
|
335 | llen(key: KeyType): Promise<number>;
|
336 |
|
337 | lindex(key: KeyType, index: number, callback: Callback<string>): void;
|
338 | lindex(key: KeyType, index: number): Promise<string>;
|
339 |
|
340 | lset(key: KeyType, index: number, value: ValueType, callback: Callback<Ok>): void;
|
341 | lset(key: KeyType, index: number, value: ValueType): Promise<Ok>;
|
342 |
|
343 | lrange(key: KeyType, start: number, stop: number, callback: Callback<string[]>): void;
|
344 | lrange(key: KeyType, start: number, stop: number): Promise<string[]>;
|
345 |
|
346 | lrangeBuffer(key: KeyType, start: number, stop: number, callback: Callback<Buffer[]>): void;
|
347 | lrangeBuffer(key: KeyType, start: number, stop: number): Promise<Buffer[]>;
|
348 |
|
349 | ltrim(key: KeyType, start: number, stop: number, callback: Callback<Ok>): void;
|
350 | ltrim(key: KeyType, start: number, stop: number): Promise<Ok>;
|
351 |
|
352 | lrem(key: KeyType, count: number, value: ValueType, callback: Callback<number>): void;
|
353 | lrem(key: KeyType, count: number, value: ValueType): Promise<number>;
|
354 |
|
355 | rpoplpush(source: string, destination: string, callback: Callback<string>): void;
|
356 | rpoplpush(source: string, destination: string): Promise<string>;
|
357 |
|
358 | rpoplpushBuffer(source: string, destination: string, callback: Callback<Buffer>): void;
|
359 | rpoplpushBuffer(source: string, destination: string): Promise<Buffer>;
|
360 |
|
361 | sadd: OverloadedKeyCommand<ValueType, number>;
|
362 |
|
363 | srem: OverloadedKeyCommand<ValueType, number>;
|
364 |
|
365 | smove(source: string, destination: string, member: string, callback: Callback<BooleanResponse>): void;
|
366 | smove(source: string, destination: string, member: string): Promise<BooleanResponse>;
|
367 |
|
368 | sismember(key: KeyType, member: string, callback: Callback<BooleanResponse>): void;
|
369 | sismember(key: KeyType, member: string): Promise<BooleanResponse>;
|
370 |
|
371 | scard(key: KeyType, callback: Callback<number>): void;
|
372 | scard(key: KeyType): Promise<number>;
|
373 |
|
374 | spop(key: KeyType, callback: Callback<string | null>): void;
|
375 | spop(key: KeyType): Promise<string | null>;
|
376 | spop(key: KeyType, count: number, callback: Callback<string[]>): void;
|
377 | spop(key: KeyType, count: number): Promise<string[]>;
|
378 |
|
379 | srandmember(key: KeyType, callback: Callback<string | null>): void;
|
380 | srandmember(key: KeyType): Promise<string | null>;
|
381 | srandmember(key: KeyType, count: number, callback: Callback<string[]>): void;
|
382 | srandmember(key: KeyType, count: number): Promise<string[]>;
|
383 |
|
384 | sinter: OverloadedListCommand<KeyType, string[]>;
|
385 |
|
386 | sinterstore: OverloadedKeyCommand<KeyType, number>;
|
387 |
|
388 | sunion: OverloadedListCommand<KeyType, string[]>;
|
389 |
|
390 | sunionstore: OverloadedKeyCommand<KeyType, number>;
|
391 |
|
392 | sdiff: OverloadedListCommand<KeyType, string[]>;
|
393 |
|
394 | sdiffstore: OverloadedKeyCommand<KeyType, number>;
|
395 |
|
396 | smembers(key: KeyType, callback: Callback<string[]>): void;
|
397 | smembers(key: KeyType): Promise<string[]>;
|
398 |
|
399 | zadd: OverloadedKeyCommand<KeyType | number, number | string>;
|
400 |
|
401 | zaddBuffer(key: KeyType, score1: number, member1: Buffer, callback: Callback<string | number>): void;
|
402 | zaddBuffer(key: KeyType, score1: number, member1: Buffer): Promise<string | number>;
|
403 |
|
404 | zincrby(key: KeyType, increment: number, member: string, callback: Callback<string>): void;
|
405 | zincrby(key: KeyType, increment: number, member: string): Promise<string>;
|
406 |
|
407 | zpopmin(key: KeyType, callback: Callback<string[]>): void;
|
408 | zpopmin(key: KeyType, count: number, callback: Callback<string[]>): void;
|
409 | zpopmin(key: KeyType, count?: number): Promise<string[]>;
|
410 |
|
411 | zpopmax(key: KeyType, callback: Callback<string[]>): void;
|
412 | zpopmax(key: KeyType, count: number, callback: Callback<string[]>): void;
|
413 | zpopmax(key: KeyType, count?: number): Promise<string[]>;
|
414 |
|
415 | bzpopmin: OverloadedBlockingListCommand<KeyType, [string, string, string]>;
|
416 |
|
417 | bzpopmax: OverloadedBlockingListCommand<KeyType, [string, string, string]>;
|
418 |
|
419 | zrem: OverloadedKeyCommand<ValueType, number>;
|
420 |
|
421 | zremrangebyscore(key: KeyType, min: number | string, max: number | string, callback: Callback<number>): void;
|
422 | zremrangebyscore(key: KeyType, min: number | string, max: number | string): Promise<number>;
|
423 |
|
424 | zremrangebyrank(key: KeyType, start: number, stop: number, callback: Callback<number>): void;
|
425 | zremrangebyrank(key: KeyType, start: number, stop: number): Promise<number>;
|
426 |
|
427 | zremrangebylex(
|
428 | key: KeyType,
|
429 | min: string,
|
430 | max: string,
|
431 | ): Promise<number>;
|
432 | zremrangebylex(
|
433 | key: KeyType,
|
434 | min: string,
|
435 | max: string,
|
436 | callback: Callback<number>
|
437 | ): void;
|
438 |
|
439 | zunionstore: OverloadedKeyCommand<KeyType | number, number>;
|
440 |
|
441 | zinterstore: OverloadedKeyCommand<KeyType | number, number>;
|
442 |
|
443 | zrange(key: KeyType, start: number, stop: number, callback: Callback<string[]>): void;
|
444 | zrange(key: KeyType, start: number, stop: number, withScores: 'WITHSCORES', callback: Callback<string[]>): void;
|
445 | zrange(key: KeyType, start: number, stop: number, withScores?: 'WITHSCORES'): Promise<string[]>;
|
446 |
|
447 | zrevrange(key: KeyType, start: number, stop: number, callback: Callback<string[]>): void;
|
448 | zrevrange(
|
449 | key: KeyType,
|
450 | start: number,
|
451 | stop: number,
|
452 | withScores: 'WITHSCORES',
|
453 | callback: Callback<string[]>,
|
454 | ): void;
|
455 | zrevrange(key: KeyType, start: number, stop: number, withScores?: 'WITHSCORES'): Promise<string[]>;
|
456 |
|
457 | zrangebyscore(
|
458 | key: KeyType,
|
459 | min: number | string,
|
460 | max: number | string,
|
461 | withScores?: 'WITHSCORES',
|
462 | ): Promise<string[]>;
|
463 | zrangebyscore(
|
464 | key: KeyType,
|
465 | min: number | string,
|
466 | max: number | string,
|
467 | withScores: 'WITHSCORES',
|
468 | limit: 'LIMIT',
|
469 | offset: number,
|
470 | count: number,
|
471 | ): Promise<string[]>;
|
472 | zrangebyscore(
|
473 | key: KeyType,
|
474 | min: number | string,
|
475 | max: number | string,
|
476 | limit: 'LIMIT',
|
477 | offset: number,
|
478 | count: number,
|
479 | ): Promise<string[]>;
|
480 | zrangebyscore(key: KeyType, min: number | string, max: number | string, callback: Callback<string[]>): void;
|
481 | zrangebyscore(
|
482 | key: KeyType,
|
483 | min: number | string,
|
484 | max: number | string,
|
485 | withScores: 'WITHSCORES',
|
486 | callback: Callback<string[]>,
|
487 | ): void;
|
488 | zrangebyscore(
|
489 | key: KeyType,
|
490 | min: number | string,
|
491 | max: number | string,
|
492 | withScores: 'WITHSCORES',
|
493 | limit: 'LIMIT',
|
494 | offset: number,
|
495 | count: number,
|
496 | callback: Callback<string[]>,
|
497 | ): void;
|
498 | zrangebyscore(
|
499 | key: KeyType,
|
500 | min: number | string,
|
501 | max: number | string,
|
502 | limit: 'LIMIT',
|
503 | offset: number,
|
504 | count: number,
|
505 | callback: Callback<string[]>,
|
506 | ): void;
|
507 |
|
508 | zrevrangebyscore(
|
509 | key: KeyType,
|
510 | max: number | string,
|
511 | min: number | string,
|
512 | withScores?: 'WITHSCORES',
|
513 | ): Promise<string[]>;
|
514 | zrevrangebyscore(
|
515 | key: KeyType,
|
516 | max: number | string,
|
517 | min: number | string,
|
518 | withScores: 'WITHSCORES',
|
519 | limit: 'LIMIT',
|
520 | offset: number,
|
521 | count: number,
|
522 | ): Promise<string[]>;
|
523 | zrevrangebyscore(
|
524 | key: KeyType,
|
525 | max: number | string,
|
526 | min: number | string,
|
527 | limit: 'LIMIT',
|
528 | offset: number,
|
529 | count: number,
|
530 | ): Promise<string[]>;
|
531 | zrevrangebyscore(key: KeyType, max: number | string, min: number | string, callback: Callback<string[]>): void;
|
532 | zrevrangebyscore(
|
533 | key: KeyType,
|
534 | max: number | string,
|
535 | min: number | string,
|
536 | withScores: 'WITHSCORES',
|
537 | callback: Callback<string[]>,
|
538 | ): void;
|
539 | zrevrangebyscore(
|
540 | key: KeyType,
|
541 | max: number | string,
|
542 | min: number | string,
|
543 | withScores: 'WITHSCORES',
|
544 | limit: 'LIMIT',
|
545 | offset: number,
|
546 | count: number,
|
547 | callback: Callback<string[]>,
|
548 | ): void;
|
549 | zrevrangebyscore(
|
550 | key: KeyType,
|
551 | max: number | string,
|
552 | min: number | string,
|
553 | limit: 'LIMIT',
|
554 | offset: number,
|
555 | count: number,
|
556 | callback: Callback<string[]>,
|
557 | ): void;
|
558 |
|
559 | zrangebylex(
|
560 | key: KeyType,
|
561 | min: string,
|
562 | max: string,
|
563 | ): Promise<string[]>;
|
564 | zrangebylex(
|
565 | key: KeyType,
|
566 | min: string,
|
567 | max: string,
|
568 | limit: 'LIMIT',
|
569 | offset: number,
|
570 | count: number,
|
571 | ): Promise<string[]>;
|
572 | zrangebylex(
|
573 | key: KeyType,
|
574 | min: string,
|
575 | max: string,
|
576 | callback: Callback<string[]>,
|
577 | ): void;
|
578 | zrangebylex(
|
579 | key: KeyType,
|
580 | min: string,
|
581 | max: string,
|
582 | limit: 'LIMIT',
|
583 | offset: number,
|
584 | count: number,
|
585 | callback: Callback<string[]>,
|
586 | ): void;
|
587 |
|
588 | zrevrangebylex(
|
589 | key: KeyType,
|
590 | min: string,
|
591 | max: string,
|
592 | ): Promise<string[]>;
|
593 | zrevrangebylex(
|
594 | key: KeyType,
|
595 | min: string,
|
596 | max: string,
|
597 | limit: 'LIMIT',
|
598 | offset: number,
|
599 | count: number,
|
600 | ): Promise<string[]>;
|
601 | zrevrangebylex(
|
602 | key: KeyType,
|
603 | min: string,
|
604 | max: string,
|
605 | callback: Callback<string[]>,
|
606 | ): void;
|
607 | zrevrangebylex(
|
608 | key: KeyType,
|
609 | min: string,
|
610 | max: string,
|
611 | limit: 'LIMIT',
|
612 | offset: number,
|
613 | count: number,
|
614 | callback: Callback<string[]>,
|
615 | ): void;
|
616 |
|
617 | zcount(key: KeyType, min: number | string, max: number | string, callback: Callback<number>): void;
|
618 | zcount(key: KeyType, min: number | string, max: number | string): Promise<number>;
|
619 |
|
620 | zcard(key: KeyType, callback: Callback<number>): void;
|
621 | zcard(key: KeyType): Promise<number>;
|
622 |
|
623 | zscore(key: KeyType, member: string, callback: Callback<string>): void;
|
624 | zscore(key: KeyType, member: string): Promise<string>;
|
625 |
|
626 | zrank(key: KeyType, member: string, callback: Callback<number | null>): void;
|
627 | zrank(key: KeyType, member: string): Promise<number | null>;
|
628 |
|
629 | zrevrank(key: KeyType, member: string, callback: Callback<number | null>): void;
|
630 | zrevrank(key: KeyType, member: string): Promise<number | null>;
|
631 |
|
632 | hset: OverloadedKeyedHashCommand<ValueType, Ok>;
|
633 |
|
634 | hsetBuffer(key: KeyType, field: string, value: ValueType, callback: Callback<BooleanResponse>): void;
|
635 | hsetBuffer(key: KeyType, field: string, value: ValueType): Promise<Buffer>;
|
636 |
|
637 | hsetnx(key: KeyType, field: string, value: ValueType, callback: Callback<BooleanResponse>): void;
|
638 | hsetnx(key: KeyType, field: string, value: ValueType): Promise<BooleanResponse>;
|
639 |
|
640 | hget(key: KeyType, field: string, callback: Callback<string | null>): void;
|
641 | hget(key: KeyType, field: string): Promise<string | null>;
|
642 | hgetBuffer(key: KeyType, field: string, callback: Callback<Buffer>): void;
|
643 | hgetBuffer(key: KeyType, field: string): Promise<Buffer>;
|
644 |
|
645 | hmset: OverloadedKeyedHashCommand<ValueType, Ok>;
|
646 |
|
647 | hmget: OverloadedKeyCommand<KeyType, Array<string | null>>;
|
648 |
|
649 | hstrlen(key: KeyType, field: string, callback: Callback<number>): void;
|
650 | hstrlen(key: KeyType, field: string): Promise<number>;
|
651 |
|
652 | hincrby(key: KeyType, field: string, increment: number, callback: Callback<number>): void;
|
653 | hincrby(key: KeyType, field: string, increment: number): Promise<number>;
|
654 |
|
655 | hincrbyfloat(key: KeyType, field: string, increment: number, callback: Callback<number>): void;
|
656 | hincrbyfloat(key: KeyType, field: string, increment: number): Promise<number>;
|
657 |
|
658 | hdel: OverloadedKeyCommand<KeyType, number>;
|
659 |
|
660 | hlen(key: KeyType, callback: Callback<number>): void;
|
661 | hlen(key: KeyType): Promise<number>;
|
662 |
|
663 | hkeys(key: KeyType, callback: Callback<string[]>): void;
|
664 | hkeys(key: KeyType): Promise<string[]>;
|
665 |
|
666 | hvals(key: KeyType, callback: Callback<string[]>): void;
|
667 | hvals(key: KeyType): Promise<string[]>;
|
668 |
|
669 | hgetall(key: KeyType, callback: Callback<Record<string, string>>): void;
|
670 | hgetall(key: KeyType): Promise<Record<string, string>>;
|
671 |
|
672 | hexists(key: KeyType, field: string, callback: Callback<BooleanResponse>): void;
|
673 | hexists(key: KeyType, field: string): Promise<BooleanResponse>;
|
674 |
|
675 | incrby(key: KeyType, increment: number, callback: Callback<number>): void;
|
676 | incrby(key: KeyType, increment: number): Promise<number>;
|
677 |
|
678 | incrbyfloat(key: KeyType, increment: number, callback: Callback<number>): void;
|
679 | incrbyfloat(key: KeyType, increment: number): Promise<number>;
|
680 |
|
681 | decrby(key: KeyType, decrement: number, callback: Callback<number>): void;
|
682 | decrby(key: KeyType, decrement: number): Promise<number>;
|
683 |
|
684 | getset(key: KeyType, value: ValueType, callback: Callback<string | null>): void;
|
685 | getset(key: KeyType, value: ValueType): Promise<string | null>;
|
686 |
|
687 | mset: OverloadedHashCommand<ValueType, Ok>;
|
688 | msetnx: OverloadedHashCommand<ValueType, BooleanResponse>;
|
689 |
|
690 | memory(argument: 'USAGE', key: KeyType, callback?: Callback<number>): Promise<number>;
|
691 |
|
692 | randomkey(callback: Callback<string>): void;
|
693 | randomkey(): Promise<string>;
|
694 |
|
695 | select(index: number, callback: Callback<Ok>): void;
|
696 | select(index: number): Promise<Ok>;
|
697 |
|
698 | move(key: KeyType, db: string, callback: Callback<BooleanResponse>): void;
|
699 | move(key: KeyType, db: string): Promise<BooleanResponse>;
|
700 |
|
701 | rename(key: KeyType, newkey: KeyType, callback: Callback<Ok>): void;
|
702 | rename(key: KeyType, newkey: KeyType): Promise<Ok>;
|
703 |
|
704 | renamenx(key: KeyType, newkey: KeyType, callback: Callback<BooleanResponse>): void;
|
705 | renamenx(key: KeyType, newkey: KeyType): Promise<BooleanResponse>;
|
706 |
|
707 | expire(key: KeyType, seconds: number, callback: Callback<BooleanResponse>): void;
|
708 | expire(key: KeyType, seconds: number): Promise<BooleanResponse>;
|
709 |
|
710 | pexpire(key: KeyType, milliseconds: number, callback: Callback<BooleanResponse>): void;
|
711 | pexpire(key: KeyType, milliseconds: number): Promise<BooleanResponse>;
|
712 |
|
713 | expireat(key: KeyType, timestamp: number, callback: Callback<BooleanResponse>): void;
|
714 | expireat(key: KeyType, timestamp: number): Promise<BooleanResponse>;
|
715 |
|
716 | pexpireat(key: KeyType, millisecondsTimestamp: number, callback: Callback<BooleanResponse>): void;
|
717 | pexpireat(key: KeyType, millisecondsTimestamp: number): Promise<BooleanResponse>;
|
718 |
|
719 | keys(pattern: string, callback: Callback<string[]>): void;
|
720 | keys(pattern: string): Promise<string[]>;
|
721 |
|
722 | dbsize(callback: Callback<number>): void;
|
723 | dbsize(): Promise<number>;
|
724 |
|
725 | auth(username: string, password: string, callback: Callback<string>): void;
|
726 | auth(password: string, callback: Callback<string>): void;
|
727 |
|
728 | auth(username: string, password: string): Promise<string>;
|
729 | auth(password: string): Promise<string>;
|
730 |
|
731 | ping(callback: Callback<string>): void;
|
732 | ping(message: string, callback: Callback<string>): void;
|
733 | ping(message?: string): Promise<string>;
|
734 |
|
735 | echo(message: string, callback: Callback<string>): void;
|
736 | echo(message: string): Promise<string>;
|
737 |
|
738 | save(callback: Callback<string>): void;
|
739 | save(): Promise<string>;
|
740 |
|
741 | bgsave(callback: Callback<string>): void;
|
742 | bgsave(): Promise<string>;
|
743 |
|
744 | bgrewriteaof(callback: Callback<string>): void;
|
745 | bgrewriteaof(): Promise<string>;
|
746 |
|
747 | shutdown(save: 'SAVE' | 'NOSAVE', callback: Callback<never>): void;
|
748 | shutdown(save: 'SAVE' | 'NOSAVE'): Promise<never>;
|
749 |
|
750 | lastsave(callback: Callback<number>): void;
|
751 | lastsave(): Promise<number>;
|
752 |
|
753 | type(key: KeyType, callback: Callback<string>): void;
|
754 | type(key: KeyType): Promise<string>;
|
755 |
|
756 | multi(commands?: string[][], options?: MultiOptions): Pipeline;
|
757 | multi(options: { pipeline: false }): Promise<Ok>;
|
758 |
|
759 | exec(callback: Callback<Array<[Error | null, string]>>): void;
|
760 | exec(): Promise<Array<[Error | null, string]>>;
|
761 |
|
762 | discard(callback: Callback<Ok>): void;
|
763 | discard(): Promise<Ok>;
|
764 |
|
765 | sync(callback: Callback<any>): void;
|
766 | sync(): Promise<any>;
|
767 |
|
768 | flushdb(callback: Callback<Ok>): void;
|
769 | flushdb(): Promise<Ok>;
|
770 |
|
771 | flushall(callback: Callback<Ok>): void;
|
772 | flushall(): Promise<Ok>;
|
773 |
|
774 | sort: OverloadedListCommand<KeyType | number, string[] | number>;
|
775 |
|
776 | info(callback: Callback<string>): void;
|
777 | info(section: string, callback: Callback<string>): void;
|
778 | info(section?: string): Promise<string>;
|
779 |
|
780 | time(callback: Callback<[string, string]>): void;
|
781 | time(): Promise<[string, string]>;
|
782 |
|
783 | monitor(callback: Callback<EventEmitter>): void;
|
784 | monitor(): Promise<EventEmitter>;
|
785 |
|
786 | ttl(key: KeyType, callback: Callback<number>): void;
|
787 | ttl(key: KeyType): Promise<number>;
|
788 |
|
789 | pttl(key: KeyType, callback: Callback<number>): void;
|
790 | pttl(key: KeyType): Promise<number>;
|
791 |
|
792 | persist(key: KeyType, callback: Callback<BooleanResponse>): void;
|
793 | persist(key: KeyType): Promise<BooleanResponse>;
|
794 |
|
795 | slaveof(host: string, port: number, callback: Callback<string>): void;
|
796 | slaveof(host: string, port: number): Promise<string>;
|
797 |
|
798 | debug: OverloadedSubCommand<ValueType, any>;
|
799 |
|
800 | config(op: 'GET', cfg: string): Promise<string[]>;
|
801 | config(op: 'GET', cfg: string, callback: Callback<string[]>): void;
|
802 | config(op: 'REWRITE' | 'RESETSTAT'): Promise<Ok>;
|
803 | config(op: 'REWRITE' | 'RESETSTAT', callback: Callback<Ok>): void;
|
804 | config(op: 'SET', key: string, value: ValueType): Promise<Ok>;
|
805 | config(op: 'SET', key: string, value: ValueType, callback: Callback<Ok>): void;
|
806 |
|
807 | subscribe: OverloadedListCommand<string, number>;
|
808 |
|
809 | unsubscribe: OverloadedCommand<string, number>;
|
810 |
|
811 | psubscribe: OverloadedListCommand<string, number>;
|
812 |
|
813 | punsubscribe: OverloadedCommand<string, number>;
|
814 |
|
815 | publish(channel: string, message: string, callback: Callback<number>): void;
|
816 | publish(channel: string, message: string): Promise<number>;
|
817 |
|
818 | publishBuffer(channel: string, message: Buffer): Promise<number>;
|
819 |
|
820 | watch: OverloadedListCommand<KeyType, Ok>;
|
821 |
|
822 | unwatch(callback: Callback<string>): void;
|
823 | unwatch(): Promise<string>;
|
824 |
|
825 | cluster: OverloadedSubCommand<ValueType, any>;
|
826 |
|
827 | restore: OverloadedListCommand<ValueType, Ok>;
|
828 |
|
829 | migrate: OverloadedListCommand<ValueType, Ok | 'NOKEY'>;
|
830 |
|
831 | dump(key: KeyType, callback: Callback<string>): void;
|
832 | dump(key: KeyType): Promise<string>;
|
833 |
|
834 | object: OverloadedListCommand<ValueType, any>;
|
835 |
|
836 | client: OverloadedSubCommand<ValueType, any>;
|
837 |
|
838 | eval: OverloadedEvalCommand<ValueType, any>;
|
839 |
|
840 | evalsha: OverloadedEvalCommand<ValueType, any>;
|
841 |
|
842 | script: OverloadedSubCommand<ValueType, any>;
|
843 |
|
844 | quit(callback: Callback<Ok>): void;
|
845 | quit(): Promise<Ok>;
|
846 |
|
847 | scan(cursor: number | string, matchOption: 'match' | 'MATCH', pattern: string): Promise<[string, string[]]>;
|
848 | scan(
|
849 | cursor: number | string,
|
850 | matchOption: 'match' | 'MATCH',
|
851 | pattern: string,
|
852 | callback: Callback<[string, string[]]>,
|
853 | ): void;
|
854 | scan(cursor: number | string, countOption: 'count' | 'COUNT', count: number): Promise<[string, string[]]>;
|
855 | scan(
|
856 | cursor: number | string,
|
857 | countOption: 'count' | 'COUNT',
|
858 | count: number,
|
859 | callback: Callback<[string, string[]]>,
|
860 | ): void;
|
861 |
|
862 | scan(
|
863 | cursor: number | string,
|
864 | matchOption: 'match' | 'MATCH',
|
865 | pattern: string,
|
866 | countOption: 'count' | 'COUNT',
|
867 | count: number,
|
868 | ): Promise<[string, string[]]>;
|
869 | scan(
|
870 | cursor: number | string,
|
871 | matchOption: 'match' | 'MATCH',
|
872 | pattern: string,
|
873 | countOption: 'count' | 'COUNT',
|
874 | count: number,
|
875 | callback: Callback<[string, string[]]>,
|
876 | ): void;
|
877 | scan(
|
878 | cursor: number | string,
|
879 | countOption: 'count' | 'COUNT',
|
880 | count: number,
|
881 | matchOption: 'match' | 'MATCH',
|
882 | pattern: string,
|
883 | ): Promise<[string, string[]]>;
|
884 | scan(
|
885 | cursor: number | string,
|
886 | countOption: 'count' | 'COUNT',
|
887 | count: number,
|
888 | matchOption: 'match' | 'MATCH',
|
889 | pattern: string,
|
890 | callback: Callback<[string, string[]]>,
|
891 | ): void;
|
892 |
|
893 | sscan: OverloadedKeyCommand<ValueType, [string, string[]]>;
|
894 |
|
895 | hscan: OverloadedKeyCommand<ValueType, [string, string[]]>;
|
896 |
|
897 | zscan: OverloadedKeyCommand<ValueType, [string, string[]]>;
|
898 |
|
899 | pfmerge: OverloadedKeyCommand<KeyType, Ok>;
|
900 |
|
901 | pfadd: OverloadedKeyCommand<string, number>;
|
902 |
|
903 | pfcount: OverloadedListCommand<KeyType, number>;
|
904 |
|
905 | pipeline(commands?: string[][]): Pipeline;
|
906 |
|
907 | scanStream(options?: ScanStreamOption): Readable;
|
908 | sscanStream(key: KeyType, options?: ScanStreamOption): Readable;
|
909 | hscanStream(key: KeyType, options?: ScanStreamOption): Readable;
|
910 | zscanStream(key: KeyType, options?: ScanStreamOption): Readable;
|
911 |
|
912 | xack: OverloadedKeyCommand<ValueType, number>;
|
913 |
|
914 | xadd: OverloadedKeyCommand<ValueType, string>;
|
915 |
|
916 | xclaim: OverloadedKeyCommand<ValueType, Array<[string, string[]]>>;
|
917 |
|
918 | xdel: OverloadedKeyCommand<string, number>;
|
919 |
|
920 | xgroup: OverloadedSubCommand<ValueType, Ok>;
|
921 |
|
922 | xinfo: OverloadedSubCommand<ValueType, any>;
|
923 |
|
924 | xlen(key: KeyType): Promise<number>;
|
925 | xlen(key: KeyType, callback: Callback<number>): void;
|
926 |
|
927 | xpending: OverloadedKeyCommand<ValueType, any>;
|
928 |
|
929 | xrange: OverloadedKeyCommand<ValueType, Array<[string, string[]]>>;
|
930 |
|
931 | xread: OverloadedListCommand<ValueType, Array<[string, string[]]>>;
|
932 |
|
933 | xreadgroup: OverloadedKeyCommand<ValueType, Array<[string, string[]]>>;
|
934 |
|
935 | xrevrange: OverloadedKeyCommand<ValueType, Array<[string, string[]]>>;
|
936 |
|
937 | xtrim: OverloadedKeyCommand<ValueType, number>;
|
938 | }
|
939 |
|
940 | interface Redis extends EventEmitter, Commander, Commands {
|
941 | Promise: typeof Promise;
|
942 | readonly options: RedisOptions;
|
943 | readonly status: string;
|
944 | connect(callback?: () => void): Promise<void>;
|
945 | disconnect(): void;
|
946 | duplicate(): Redis;
|
947 |
|
948 | send_command(command: string, ...args: ValueType[]): Promise<any>;
|
949 | }
|
950 |
|
951 | interface Pipeline {
|
952 | readonly redis: Redis | Cluster;
|
953 | readonly isCluster: boolean;
|
954 | readonly options: RedisOptions | ClusterOptions;
|
955 | readonly length: number;
|
956 |
|
957 | bitcount(key: KeyType, callback?: Callback<number>): Pipeline;
|
958 | bitcount(key: KeyType, start: number, end: number, callback?: Callback<number>): Pipeline;
|
959 |
|
960 | get(key: KeyType, callback?: Callback<string>): Pipeline;
|
961 | getBuffer(key: KeyType, callback?: Callback<Buffer>): Pipeline;
|
962 |
|
963 | set(key: KeyType, value: ValueType, callback?: Callback<string>): Pipeline;
|
964 | set(key: KeyType, value: ValueType, setMode: string, callback?: Callback<string>): Pipeline;
|
965 | set(key: KeyType, value: ValueType, expiryMode: string, time: number, callback?: Callback<string>): Pipeline;
|
966 | set(
|
967 | key: KeyType,
|
968 | value: ValueType,
|
969 | expiryMode: string,
|
970 | time: number,
|
971 | setMode: string,
|
972 | callback?: Callback<string>,
|
973 | ): Pipeline;
|
974 |
|
975 | setBuffer(key: KeyType, value: ValueType, callback?: Callback<Buffer>): Pipeline;
|
976 | setBuffer(key: KeyType, value: ValueType, setMode: string, callback?: Callback<Buffer>): Pipeline;
|
977 | setBuffer(
|
978 | key: KeyType,
|
979 | value: ValueType,
|
980 | expiryMode: string,
|
981 | time: number,
|
982 | callback?: Callback<Buffer>,
|
983 | ): Pipeline;
|
984 | setBuffer(
|
985 | key: KeyType,
|
986 | value: ValueType,
|
987 | expiryMode: string,
|
988 | time: number,
|
989 | setMode: string,
|
990 | callback?: Callback<Buffer>,
|
991 | ): Pipeline;
|
992 |
|
993 | setnx(key: KeyType, value: ValueType, callback?: Callback<BooleanResponse>): Pipeline;
|
994 |
|
995 | setex(key: KeyType, seconds: number, value: ValueType, callback?: Callback<Ok>): Pipeline;
|
996 |
|
997 | psetex(key: KeyType, milliseconds: number, value: ValueType, callback?: Callback<Ok>): Pipeline;
|
998 |
|
999 | append(key: KeyType, value: ValueType, callback?: Callback<number>): Pipeline;
|
1000 |
|
1001 | strlen(key: KeyType, callback?: Callback<number>): Pipeline;
|
1002 |
|
1003 | del(...keys: KeyType[]): Pipeline;
|
1004 |
|
1005 | unlink(...keys: KeyType[]): Pipeline;
|
1006 |
|
1007 | exists(...keys: KeyType[]): Pipeline;
|
1008 |
|
1009 | setbit(key: KeyType, offset: number, value: ValueType, callback?: Callback<number>): Pipeline;
|
1010 |
|
1011 | getbit(key: KeyType, offset: number, callback?: Callback<number>): Pipeline;
|
1012 |
|
1013 | setrange(key: KeyType, offset: number, value: ValueType, callback?: Callback<number>): Pipeline;
|
1014 |
|
1015 | getrange(key: KeyType, start: number, end: number, callback?: Callback<string>): Pipeline;
|
1016 |
|
1017 | getrangeBuffer(key: KeyType, start: number, end: number, callback?: Callback<Buffer>): Pipeline;
|
1018 |
|
1019 | substr(key: KeyType, start: number, end: number, callback?: Callback<string>): Pipeline;
|
1020 |
|
1021 | incr(key: KeyType, callback?: Callback<number>): Pipeline;
|
1022 |
|
1023 | decr(key: KeyType, callback?: Callback<number>): Pipeline;
|
1024 |
|
1025 | mget(...keys: KeyType[]): Pipeline;
|
1026 |
|
1027 | rpush(key: KeyType, ...values: ValueType[]): Pipeline;
|
1028 |
|
1029 | rpushBuffer(key: string, ...values: Buffer[]): Pipeline;
|
1030 |
|
1031 | lpush(key: KeyType, ...values: ValueType[]): Pipeline;
|
1032 |
|
1033 | rpushx(key: KeyType, value: ValueType, callback?: Callback<number>): Pipeline;
|
1034 |
|
1035 | lpushx(key: KeyType, value: ValueType, callback?: Callback<number>): Pipeline;
|
1036 |
|
1037 | linsert(
|
1038 | key: KeyType,
|
1039 | direction: 'BEFORE' | 'AFTER',
|
1040 | pivot: string,
|
1041 | value: ValueType,
|
1042 | callback?: Callback<number>,
|
1043 | ): Pipeline;
|
1044 |
|
1045 | rpop(key: KeyType, callback?: Callback<string>): Pipeline;
|
1046 |
|
1047 | lpop(key: KeyType, callback?: Callback<string>): Pipeline;
|
1048 |
|
1049 | lpopBuffer(key: KeyType, callback?: Callback<Buffer>): Pipeline;
|
1050 |
|
1051 | brpop(...keys: KeyType[]): Pipeline;
|
1052 |
|
1053 | blpop(...keys: KeyType[]): Pipeline;
|
1054 |
|
1055 | brpoplpush(source: string, destination: string, timeout: number, callback?: Callback<string>): Pipeline;
|
1056 |
|
1057 | llen(key: KeyType, callback?: Callback<number>): Pipeline;
|
1058 |
|
1059 | lindex(key: KeyType, index: number, callback?: Callback<string>): Pipeline;
|
1060 |
|
1061 | lset(key: KeyType, index: number, value: ValueType, callback?: Callback<Ok>): Pipeline;
|
1062 |
|
1063 | lrange(key: KeyType, start: number, stop: number, callback?: Callback<string[]>): Pipeline;
|
1064 |
|
1065 | lrangeBuffer(key: KeyType, start: number, stop: number, callback?: Callback<Buffer[]>): Pipeline;
|
1066 |
|
1067 | ltrim(key: KeyType, start: number, stop: number, callback?: Callback<Ok>): Pipeline;
|
1068 |
|
1069 | lrem(key: KeyType, count: number, value: ValueType, callback?: Callback<number>): Pipeline;
|
1070 |
|
1071 | rpoplpush(source: string, destination: string, callback?: Callback<string>): Pipeline;
|
1072 |
|
1073 | sadd(key: KeyType, ...members: ValueType[]): Pipeline;
|
1074 |
|
1075 | srem(key: KeyType, ...members: ValueType[]): Pipeline;
|
1076 |
|
1077 | smove(source: string, destination: string, member: string, callback?: Callback<string>): Pipeline;
|
1078 |
|
1079 | sismember(key: KeyType, member: string, callback?: Callback<BooleanResponse>): Pipeline;
|
1080 |
|
1081 | scard(key: KeyType, callback?: Callback<number>): Pipeline;
|
1082 |
|
1083 | spop(key: KeyType, callback?: Callback<string | null>): Pipeline;
|
1084 | spop(key: KeyType, count: number, callback?: Callback<string[]>): Pipeline;
|
1085 |
|
1086 | srandmember(key: KeyType, callback?: Callback<string | null>): Pipeline;
|
1087 | srandmember(key: KeyType, count: number, callback?: Callback<string[]>): Pipeline;
|
1088 |
|
1089 | sinter(...keys: KeyType[]): Pipeline;
|
1090 |
|
1091 | sinterstore(destination: string, ...keys: KeyType[]): Pipeline;
|
1092 |
|
1093 | sunion(...keys: KeyType[]): Pipeline;
|
1094 |
|
1095 | sunionstore(destination: string, ...keys: KeyType[]): Pipeline;
|
1096 |
|
1097 | sdiff(...keys: KeyType[]): Pipeline;
|
1098 |
|
1099 | sdiffstore(destination: string, ...keys: KeyType[]): Pipeline;
|
1100 |
|
1101 | smembers(key: KeyType, callback?: Callback<string[]>): Pipeline;
|
1102 |
|
1103 | zadd(key: KeyType, ...args: string[]): Pipeline;
|
1104 |
|
1105 | zincrby(key: KeyType, increment: number, member: string, callback?: Callback<string>): Pipeline;
|
1106 |
|
1107 | zpopmin(key: KeyType, count: number, callback?: Callback<string[]>): Pipeline;
|
1108 |
|
1109 | zpopmax(key: KeyType, count: number, callback?: Callback<string[]>): Pipeline;
|
1110 |
|
1111 | bzpopmin(...args: Array<string | number | Callback<[string, string, string]>>): Pipeline;
|
1112 |
|
1113 | bzpopmax(...args: Array<string | number | Callback<[string, string, string]>>): Pipeline;
|
1114 |
|
1115 | zrem(key: KeyType, ...members: ValueType[]): Pipeline;
|
1116 |
|
1117 | zremrangebyscore(
|
1118 | key: KeyType,
|
1119 | min: number | string,
|
1120 | max: number | string,
|
1121 | callback?: Callback<number>,
|
1122 | ): Pipeline;
|
1123 |
|
1124 | zremrangebyrank(key: KeyType, start: number, stop: number, callback?: Callback<number>): Pipeline;
|
1125 |
|
1126 | zremrangebylex(
|
1127 | key: KeyType,
|
1128 | min: string,
|
1129 | max: string,
|
1130 | callback?: Callback<number>,
|
1131 | ): Pipeline;
|
1132 |
|
1133 | zunionstore(destination: string, numkeys: number, key: KeyType, ...args: string[]): Pipeline;
|
1134 |
|
1135 | zinterstore(destination: string, numkeys: number, key: KeyType, ...args: string[]): Pipeline;
|
1136 |
|
1137 | zrange(key: KeyType, start: number, stop: number, callback?: Callback<string[]>): Pipeline;
|
1138 | zrange(
|
1139 | key: KeyType,
|
1140 | start: number,
|
1141 | stop: number,
|
1142 | withScores: 'WITHSCORES',
|
1143 | callback?: Callback<string[]>,
|
1144 | ): Pipeline;
|
1145 |
|
1146 | zrevrange(key: KeyType, start: number, stop: number, callback?: Callback<string[]>): Pipeline;
|
1147 | zrevrange(
|
1148 | key: KeyType,
|
1149 | start: number,
|
1150 | stop: number,
|
1151 | withScores: 'WITHSCORES',
|
1152 | callback?: Callback<string[]>,
|
1153 | ): Pipeline;
|
1154 |
|
1155 | zrangebyscore(key: KeyType, min: number | string, max: number | string, ...args: string[]): Pipeline;
|
1156 |
|
1157 | zrevrangebyscore(key: KeyType, max: number | string, min: number | string, ...args: string[]): Pipeline;
|
1158 |
|
1159 | zrangebylex(
|
1160 | key: KeyType,
|
1161 | min: string,
|
1162 | max: string,
|
1163 | callback?: Callback<string[]>,
|
1164 | ): Pipeline;
|
1165 | zrangebylex(
|
1166 | key: KeyType,
|
1167 | min: string,
|
1168 | max: string,
|
1169 | limit: 'LIMIT',
|
1170 | offset: number,
|
1171 | count: number,
|
1172 | callback?: Callback<string[]>,
|
1173 | ): Pipeline;
|
1174 | zrevrangebylex(
|
1175 | key: KeyType,
|
1176 | min: string,
|
1177 | max: string,
|
1178 | callback?: Callback<string[]>,
|
1179 | ): Pipeline;
|
1180 | zrevrangebylex(
|
1181 | key: KeyType,
|
1182 | min: string,
|
1183 | max: string,
|
1184 | limit: 'LIMIT',
|
1185 | offset: number,
|
1186 | count: number,
|
1187 | callback?: Callback<string[]>,
|
1188 | ): Pipeline;
|
1189 |
|
1190 | zcount(key: KeyType, min: number | string, max: number | string, callback?: Callback<number>): Pipeline;
|
1191 |
|
1192 | zcard(key: KeyType, callback?: Callback<number>): Pipeline;
|
1193 |
|
1194 | zscore(key: KeyType, member: string, callback?: Callback<number>): Pipeline;
|
1195 |
|
1196 | zrank(key: KeyType, member: string, callback?: Callback<number>): Pipeline;
|
1197 |
|
1198 | zrevrank(key: KeyType, member: string, callback?: Callback<number>): Pipeline;
|
1199 |
|
1200 | hset(key: KeyType, ...args: ValueType[]): Pipeline;
|
1201 | hset(key: KeyType, data: object | Map<string, any>, callback?: Callback<BooleanResponse>): Pipeline;
|
1202 | hset(key: KeyType, field: string, value: ValueType, callback?: Callback<BooleanResponse>): Pipeline;
|
1203 | hsetBuffer(key: KeyType, field: string, value: ValueType, callback?: Callback<Buffer>): Pipeline;
|
1204 |
|
1205 | hsetnx(key: KeyType, field: string, value: ValueType, callback?: Callback<BooleanResponse>): Pipeline;
|
1206 |
|
1207 | hget(key: KeyType, field: string, callback?: Callback<string | string>): Pipeline;
|
1208 | hgetBuffer(key: KeyType, field: string, callback?: Callback<Buffer>): Pipeline;
|
1209 |
|
1210 | hmset(key: KeyType, ...args: ValueType[]): Pipeline;
|
1211 | hmset(key: KeyType, data: object | Map<string, any>, callback?: Callback<BooleanResponse>): Pipeline;
|
1212 |
|
1213 | hmget(key: KeyType, ...fields: string[]): Pipeline;
|
1214 |
|
1215 | hstrlen(key: KeyType, field: string, callback?: Callback<number>): Pipeline;
|
1216 |
|
1217 | hincrby(key: KeyType, field: string, increment: number, callback?: Callback<number>): Pipeline;
|
1218 |
|
1219 | hincrbyfloat(key: KeyType, field: string, increment: number, callback?: Callback<number>): Pipeline;
|
1220 |
|
1221 | hdel(key: KeyType, ...fields: string[]): Pipeline;
|
1222 |
|
1223 | hlen(key: KeyType, callback?: Callback<number>): Pipeline;
|
1224 |
|
1225 | hkeys(key: KeyType, callback?: Callback<string[]>): Pipeline;
|
1226 |
|
1227 | hvals(key: KeyType, callback?: Callback<string[]>): Pipeline;
|
1228 |
|
1229 | hgetall(key: KeyType, callback?: Callback<Record<string, string>>): Pipeline;
|
1230 |
|
1231 | hexists(key: KeyType, field: string, callback?: Callback<BooleanResponse>): Pipeline;
|
1232 |
|
1233 | incrby(key: KeyType, increment: number, callback?: Callback<number>): Pipeline;
|
1234 |
|
1235 | incrbyfloat(key: KeyType, increment: number, callback?: Callback<number>): Pipeline;
|
1236 |
|
1237 | decrby(key: KeyType, decrement: number, callback?: Callback<number>): Pipeline;
|
1238 |
|
1239 | getset(key: KeyType, value: ValueType, callback?: Callback<string>): Pipeline;
|
1240 |
|
1241 | mset(...args: ValueType[]): Pipeline;
|
1242 | mset(data: object | Map<string, any>, callback?: Callback<string>): Pipeline;
|
1243 |
|
1244 | msetnx(...args: ValueType[]): Pipeline;
|
1245 | msetnx(data: object | Map<string, any>, callback?: Callback<BooleanResponse>): Pipeline;
|
1246 |
|
1247 | memory(argument: 'USAGE', key: KeyType, callback?: Callback<number>): Pipeline;
|
1248 |
|
1249 | randomkey(callback?: Callback<string>): Pipeline;
|
1250 |
|
1251 | select(index: number, callback?: Callback<string>): Pipeline;
|
1252 |
|
1253 | move(key: KeyType, db: string, callback?: Callback<BooleanResponse>): Pipeline;
|
1254 |
|
1255 | rename(key: KeyType, newkey: KeyType, callback?: Callback<string>): Pipeline;
|
1256 |
|
1257 | renamenx(key: KeyType, newkey: KeyType, callback?: Callback<BooleanResponse>): Pipeline;
|
1258 |
|
1259 | expire(key: KeyType, seconds: number, callback?: Callback<BooleanResponse>): Pipeline;
|
1260 |
|
1261 | pexpire(key: KeyType, milliseconds: number, callback?: Callback<BooleanResponse>): Pipeline;
|
1262 |
|
1263 | expireat(key: KeyType, timestamp: number, callback?: Callback<BooleanResponse>): Pipeline;
|
1264 |
|
1265 | pexpireat(key: KeyType, millisecondsTimestamp: number, callback?: Callback<BooleanResponse>): Pipeline;
|
1266 |
|
1267 | keys(pattern: string, callback?: Callback<string[]>): Pipeline;
|
1268 |
|
1269 | dbsize(callback?: Callback<number>): Pipeline;
|
1270 |
|
1271 | auth(password: string, callback?: Callback<string>): Pipeline;
|
1272 | auth(username: string, password: string, callback?: Callback<string>): Pipeline;
|
1273 |
|
1274 | ping(callback?: Callback<string>): Pipeline;
|
1275 | ping(message: string, callback?: Callback<string>): Pipeline;
|
1276 |
|
1277 | echo(message: string, callback?: Callback<string>): Pipeline;
|
1278 |
|
1279 | save(callback?: Callback<string>): Pipeline;
|
1280 |
|
1281 | bgsave(callback?: Callback<string>): Pipeline;
|
1282 |
|
1283 | bgrewriteaof(callback?: Callback<string>): Pipeline;
|
1284 |
|
1285 | shutdown(save: 'SAVE' | 'NOSAVE', callback?: Callback<never>): Pipeline;
|
1286 |
|
1287 | lastsave(callback?: Callback<number>): Pipeline;
|
1288 |
|
1289 | type(key: KeyType, callback?: Callback<string>): Pipeline;
|
1290 |
|
1291 | multi(callback?: Callback<string>): Pipeline;
|
1292 |
|
1293 | exec(callback?: Callback<Array<[Error | null, any]>>): Promise<Array<[Error | null, any]>>;
|
1294 |
|
1295 | discard(callback?: Callback<any>): Pipeline;
|
1296 |
|
1297 | sync(callback?: Callback<any>): Pipeline;
|
1298 |
|
1299 | flushdb(callback?: Callback<string>): Pipeline;
|
1300 |
|
1301 | flushall(callback?: Callback<string>): Pipeline;
|
1302 |
|
1303 | sort(key: KeyType, ...args: string[]): Pipeline;
|
1304 |
|
1305 | info(callback?: Callback<string>): Pipeline;
|
1306 | info(section: string, callback?: Callback<string>): Pipeline;
|
1307 |
|
1308 | time(callback?: Callback<[string, string]>): Pipeline;
|
1309 |
|
1310 | monitor(callback?: Callback<EventEmitter>): Pipeline;
|
1311 |
|
1312 | ttl(key: KeyType, callback?: Callback<number>): Pipeline;
|
1313 |
|
1314 | pttl(key: KeyType, callback?: Callback<number>): Pipeline;
|
1315 |
|
1316 | persist(key: KeyType, callback?: Callback<BooleanResponse>): Pipeline;
|
1317 |
|
1318 | slaveof(host: string, port: number, callback?: Callback<string>): Pipeline;
|
1319 |
|
1320 | debug(...args: ValueType[]): Pipeline;
|
1321 |
|
1322 | config(...args: ValueType[]): Pipeline;
|
1323 |
|
1324 | subscribe(...channels: ValueType[]): Pipeline;
|
1325 |
|
1326 | unsubscribe(...channels: string[]): Pipeline;
|
1327 |
|
1328 | psubscribe(...patterns: string[]): Pipeline;
|
1329 |
|
1330 | punsubscribe(...patterns: string[]): Pipeline;
|
1331 |
|
1332 | publish(channel: string, message: string, callback?: Callback<number>): Pipeline;
|
1333 |
|
1334 | watch(...keys: KeyType[]): Pipeline;
|
1335 |
|
1336 | unwatch(callback?: Callback<string>): Pipeline;
|
1337 |
|
1338 | cluster(...args: ValueType[]): Pipeline;
|
1339 |
|
1340 | restore(...args: ValueType[]): Pipeline;
|
1341 |
|
1342 | migrate(...args: ValueType[]): Pipeline;
|
1343 |
|
1344 | dump(key: KeyType, callback?: Callback<string>): Pipeline;
|
1345 |
|
1346 | object(subcommand: string, ...args: ValueType[]): Pipeline;
|
1347 |
|
1348 | client(...args: ValueType[]): Pipeline;
|
1349 |
|
1350 | eval(script: string, numKeys: number, ...args: ValueType[]): Pipeline;
|
1351 |
|
1352 | evalsha(scriptSha: string, numKeys: string, ...args: ValueType[]): Pipeline;
|
1353 |
|
1354 | script(...args: ValueType[]): Pipeline;
|
1355 |
|
1356 | quit(callback?: Callback<string>): Pipeline;
|
1357 |
|
1358 | scan(cursor: number | string): Pipeline;
|
1359 |
|
1360 | scan(cursor: number | string, matchOption: 'match' | 'MATCH', pattern: string): Pipeline;
|
1361 | scan(cursor: number | string, countOption: 'count' | 'COUNT', count: number): Pipeline;
|
1362 |
|
1363 | scan(
|
1364 | cursor: number | string,
|
1365 | matchOption: 'match' | 'MATCH',
|
1366 | pattern: string,
|
1367 | countOption: 'count' | 'COUNT',
|
1368 | count: number,
|
1369 | ): Pipeline;
|
1370 | scan(
|
1371 | cursor: number | string,
|
1372 | countOption: 'count' | 'COUNT',
|
1373 | count: number,
|
1374 | matchOption: 'match' | 'MATCH',
|
1375 | pattern: string,
|
1376 | ): Pipeline;
|
1377 | sscan(key: KeyType, cursor: number | string, ...args: ValueType[]): Pipeline;
|
1378 |
|
1379 | hscan(key: KeyType, cursor: number | string, ...args: ValueType[]): Pipeline;
|
1380 |
|
1381 | zscan(key: KeyType, cursor: number | string, ...args: ValueType[]): Pipeline;
|
1382 |
|
1383 | pfmerge(destkey: KeyType, ...sourcekeys: KeyType[]): Pipeline;
|
1384 |
|
1385 | pfadd(key: KeyType, ...elements: string[]): Pipeline;
|
1386 |
|
1387 | pfcount(...keys: KeyType[]): Pipeline;
|
1388 |
|
1389 | xack(key: KeyType, group: string, ...ids: string[]): Pipeline;
|
1390 |
|
1391 | xadd(key: KeyType, id: string, ...args: string[]): Pipeline;
|
1392 |
|
1393 | xclaim(
|
1394 | key: KeyType,
|
1395 | group: string,
|
1396 | consumer: string,
|
1397 | minIdleTime: number,
|
1398 | id: string,
|
1399 | ...args: ValueType[]
|
1400 | ): Pipeline;
|
1401 |
|
1402 | xdel(key: KeyType, ...ids: string[]): Pipeline;
|
1403 |
|
1404 | xgroup(...args: ValueType[]): Pipeline;
|
1405 |
|
1406 | xinfo(...args: ValueType[]): Pipeline;
|
1407 |
|
1408 | xlen(key: KeyType): Pipeline;
|
1409 |
|
1410 | xpending(key: KeyType, group: string, ...args: ValueType[]): Pipeline;
|
1411 |
|
1412 | xrange(key: KeyType, start: string, end: string, ...args: ValueType[]): Pipeline;
|
1413 |
|
1414 | xread(...args: ValueType[]): Pipeline;
|
1415 |
|
1416 | xreadgroup(command: 'GROUP' | 'group', group: string, consumer: string, ...args: ValueType[]): Pipeline;
|
1417 |
|
1418 | xrevrange(key: KeyType, end: string, start: string, ...args: ValueType[]): Pipeline;
|
1419 |
|
1420 | xtrim(key: KeyType, strategy: 'MAXLEN' | 'maxlen', ...args: ValueType[]): Pipeline;
|
1421 | }
|
1422 |
|
1423 | interface NodeConfiguration {
|
1424 | host?: string;
|
1425 | port?: number;
|
1426 | }
|
1427 |
|
1428 | type ClusterNode = string | number | NodeConfiguration;
|
1429 |
|
1430 | type NodeRole = 'master' | 'slave' | 'all';
|
1431 |
|
1432 | type CallbackFunction<T = any> = (err?: NodeJS.ErrnoException | null, result?: T) => void;
|
1433 |
|
1434 | type Ok = 'OK';
|
1435 |
|
1436 | interface Cluster extends EventEmitter, Commander, Commands {
|
1437 | readonly options: ClusterOptions;
|
1438 | readonly status: string;
|
1439 | connect(): Promise<void>;
|
1440 | disconnect(): void;
|
1441 | nodes(role?: NodeRole): Redis[];
|
1442 | }
|
1443 |
|
1444 | interface ClusterStatic extends EventEmitter {
|
1445 | new (nodes: ClusterNode[], options?: ClusterOptions): Cluster;
|
1446 | }
|
1447 |
|
1448 | interface RedisOptions {
|
1449 | port?: number;
|
1450 | host?: string;
|
1451 | |
1452 |
|
1453 |
|
1454 | family?: number;
|
1455 | |
1456 |
|
1457 |
|
1458 | path?: string;
|
1459 | |
1460 |
|
1461 |
|
1462 | keepAlive?: number;
|
1463 | connectionName?: string;
|
1464 | |
1465 |
|
1466 |
|
1467 | username?: string;
|
1468 | |
1469 |
|
1470 |
|
1471 | password?: string;
|
1472 | |
1473 |
|
1474 |
|
1475 | db?: number;
|
1476 | |
1477 |
|
1478 |
|
1479 |
|
1480 |
|
1481 |
|
1482 | enableReadyCheck?: boolean;
|
1483 | keyPrefix?: string;
|
1484 | |
1485 |
|
1486 |
|
1487 |
|
1488 | retryStrategy?(times: number): number | void | null;
|
1489 | |
1490 |
|
1491 |
|
1492 |
|
1493 |
|
1494 |
|
1495 |
|
1496 |
|
1497 |
|
1498 |
|
1499 | maxRetriesPerRequest?: number | null;
|
1500 | |
1501 |
|
1502 |
|
1503 |
|
1504 | reconnectOnError?(error: Error): boolean | 1 | 2;
|
1505 | |
1506 |
|
1507 |
|
1508 |
|
1509 |
|
1510 |
|
1511 |
|
1512 | enableOfflineQueue?: boolean;
|
1513 | |
1514 |
|
1515 |
|
1516 |
|
1517 | connectTimeout?: number;
|
1518 | |
1519 |
|
1520 |
|
1521 |
|
1522 | autoResubscribe?: boolean;
|
1523 | |
1524 |
|
1525 |
|
1526 |
|
1527 | autoResendUnfulfilledCommands?: boolean;
|
1528 | lazyConnect?: boolean;
|
1529 | tls?: ConnectionOptions;
|
1530 | |
1531 |
|
1532 |
|
1533 | role?: 'master' | 'slave';
|
1534 | |
1535 |
|
1536 |
|
1537 | name?: string;
|
1538 | sentinelUsername?: string;
|
1539 | sentinelPassword?: string;
|
1540 | sentinels?: Array<{ host: string; port: number }>;
|
1541 | |
1542 |
|
1543 |
|
1544 |
|
1545 | sentinelRetryStrategy?(times: number): number | void | null;
|
1546 | |
1547 |
|
1548 |
|
1549 | preferredSlaves?: PreferredSlaves;
|
1550 | |
1551 |
|
1552 |
|
1553 |
|
1554 | enableTLSForSentinelMode?: boolean;
|
1555 | sentinelTLS?: SecureContextOptions;
|
1556 | |
1557 |
|
1558 |
|
1559 |
|
1560 | natMap?: NatMap;
|
1561 | |
1562 |
|
1563 |
|
1564 |
|
1565 | updateSentinels?: boolean;
|
1566 | |
1567 |
|
1568 |
|
1569 |
|
1570 | readOnly?: boolean;
|
1571 | |
1572 |
|
1573 |
|
1574 |
|
1575 | dropBufferSupport?: boolean;
|
1576 | |
1577 |
|
1578 |
|
1579 | showFriendlyErrorStack?: boolean;
|
1580 | |
1581 |
|
1582 |
|
1583 |
|
1584 |
|
1585 | enableAutoPipelining?: boolean;
|
1586 | }
|
1587 |
|
1588 | interface AddressFromResponse {
|
1589 | port: string;
|
1590 | ip: string;
|
1591 | flags?: string;
|
1592 | }
|
1593 |
|
1594 | type PreferredSlaves =
|
1595 | | ((slaves: AddressFromResponse[]) => AddressFromResponse | null)
|
1596 | | Array<{ port: string; ip: string; prio?: number }>
|
1597 | | { port: string; ip: string; prio?: number };
|
1598 |
|
1599 | type SecureVersion = 'TLSv1.3' | 'TLSv1.2' | 'TLSv1.1' | 'TLSv1';
|
1600 |
|
1601 | interface SecureContextOptions {
|
1602 | pfx?: string | Buffer | Array<string | Buffer | object>;
|
1603 | key?: string | Buffer | Array<Buffer | object>;
|
1604 | passphrase?: string;
|
1605 | cert?: string | Buffer | Array<string | Buffer>;
|
1606 | ca?: string | Buffer | Array<string | Buffer>;
|
1607 | ciphers?: string;
|
1608 | honorCipherOrder?: boolean;
|
1609 | ecdhCurve?: string;
|
1610 | clientCertEngine?: string;
|
1611 | crl?: string | Buffer | Array<string | Buffer>;
|
1612 | dhparam?: string | Buffer;
|
1613 | secureOptions?: number; // Value is a numeric bitmask of the `SSL_OP_*` options
|
1614 | secureProtocol?: string; // SSL Method, e.g. SSLv23_method
|
1615 | sessionIdContext?: string;
|
1616 | /**
|
1617 | * Optionally set the maximum TLS version to allow. One
|
1618 | * of `'TLSv1.3'`, `'TLSv1.2'`, `'TLSv1.1'`, or `'TLSv1'`. Cannot be specified along with the
|
1619 | * `secureProtocol` option, use one or the other.
|
1620 | * **Default:** `'TLSv1.3'`, unless changed using CLI options. Using
|
1621 | * `--tls-max-v1.2` sets the default to `'TLSv1.2'`. Using `--tls-max-v1.3` sets the default to
|
1622 | * `'TLSv1.3'`. If multiple of the options are provided, the highest maximum is used.
|
1623 | */
|
1624 | maxVersion?: SecureVersion;
|
1625 | /**
|
1626 | * Optionally set the minimum TLS version to allow. One
|
1627 | * of `'TLSv1.3'`, `'TLSv1.2'`, `'TLSv1.1'`, or `'TLSv1'`. Cannot be specified along with the
|
1628 | * `secureProtocol` option, use one or the other. It is not recommended to use
|
1629 | * less than TLSv1.2, but it may be required for interoperability.
|
1630 | * **Default:** `'TLSv1.2'`, unless changed using CLI options. Using
|
1631 | * `--tls-v1.0` sets the default to `'TLSv1'`. Using `--tls-v1.1` sets the default to
|
1632 | * `'TLSv1.1'`. Using `--tls-min-v1.3` sets the default to
|
1633 | * 'TLSv1.3'. If multiple of the options are provided, the lowest minimum is used.
|
1634 | */
|
1635 | minVersion?: SecureVersion;
|
1636 | }
|
1637 |
|
1638 | interface ScanStreamOption {
|
1639 | match?: string;
|
1640 | count?: number;
|
1641 | }
|
1642 |
|
1643 | type DNSLookupFunction = (
|
1644 | hostname: string,
|
1645 | callback: (err: NodeJS.ErrnoException | null, address: string, family: number) => void,
|
1646 | ) => void;
|
1647 | interface NatMap {
|
1648 | [key: string]: { host: string; port: number };
|
1649 | }
|
1650 |
|
1651 | interface ClusterOptions {
|
1652 | clusterRetryStrategy?(times: number, reason?: Error): number | null;
|
1653 | enableOfflineQueue?: boolean;
|
1654 | enableReadyCheck?: boolean;
|
1655 | scaleReads?: string;
|
1656 | maxRedirections?: number;
|
1657 | retryDelayOnFailover?: number;
|
1658 | retryDelayOnClusterDown?: number;
|
1659 | retryDelayOnTryAgain?: number;
|
1660 | slotsRefreshTimeout?: number;
|
1661 | slotsRefreshInterval?: number;
|
1662 | redisOptions?: RedisOptions;
|
1663 | lazyConnect?: boolean;
|
1664 | dnsLookup?: DNSLookupFunction;
|
1665 | natMap?: NatMap;
|
1666 | }
|
1667 |
|
1668 | interface MultiOptions {
|
1669 | pipeline: boolean;
|
1670 | }
|
1671 | }
|