koatty_store 1.4.7 → 1.5.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,553 @@
1
+ /// <reference types="node" />
2
+ import { EventEmitter } from "events";
3
+ /**
4
+ *
5
+ *
6
+ * @enum {number}
7
+ */
8
+ export declare enum messages {
9
+ ok = "OK",
10
+ queued = "QUEUED",
11
+ pong = "PONG",
12
+ noint = "ERR value is not an integer or out of range",
13
+ nofloat = "ERR value is not an float or out of range",
14
+ nokey = "ERR no such key",
15
+ nomultiinmulti = "ERR MULTI calls can not be nested",
16
+ nomultiexec = "ERR EXEC without MULTI",
17
+ nomultidiscard = "ERR DISCARD without MULTI",
18
+ busykey = "ERR target key name is busy",
19
+ syntax = "ERR syntax error",
20
+ unsupported = "MemoryCache does not support that operation",
21
+ wrongTypeOp = "WRONGTYPE Operation against a key holding the wrong kind of value",
22
+ wrongPayload = "DUMP payload version or checksum are wrong",
23
+ wrongArgCount = "ERR wrong number of arguments for '%0' command",
24
+ bitopnotWrongCount = "ERR BITOP NOT must be called with a single source key",
25
+ indexOutOfRange = "ERR index out of range",
26
+ invalidLexRange = "ERR min or max not valid string range item",
27
+ invalidDBIndex = "ERR invalid DB index",
28
+ invalidDBIndexNX = "ERR invalid DB index, '%0' does not exist",
29
+ mutuallyExclusiveNXXX = "ERR XX and NX options at the same time are not compatible"
30
+ }
31
+ /**
32
+ *
33
+ *
34
+ * @interface MemoryCacheOptions
35
+ */
36
+ interface MemoryCacheOptions {
37
+ database: number;
38
+ }
39
+ export declare class MemoryCache extends EventEmitter {
40
+ private databases;
41
+ options: MemoryCacheOptions;
42
+ currentDBIndex: number;
43
+ connected: boolean;
44
+ lastSave: number;
45
+ multiMode: boolean;
46
+ private cache;
47
+ private tempCache;
48
+ private responseMessages;
49
+ /**
50
+ * Creates an instance of MemoryCache.
51
+ * @param {*} options
52
+ * @memberof MemoryCache
53
+ */
54
+ constructor(options: MemoryCacheOptions);
55
+ /**
56
+ *
57
+ *
58
+ * @returns {*}
59
+ * @memberof MemoryCache
60
+ */
61
+ createClient(): this;
62
+ /**
63
+ *
64
+ *
65
+ * @returns {*}
66
+ * @memberof MemoryCache
67
+ */
68
+ quit(): this;
69
+ /**
70
+ *
71
+ *
72
+ * @returns {*}
73
+ * @memberof MemoryCache
74
+ */
75
+ end(): this;
76
+ /**
77
+ *
78
+ *
79
+ * @param {string} message
80
+ * @param {Function} [callback]
81
+ * @returns {*}
82
+ * @memberof MemoryCache
83
+ */
84
+ echo(message: string, callback?: Function): any;
85
+ /**
86
+ *
87
+ *
88
+ * @param {string} message
89
+ * @param {Function} [callback]
90
+ * @returns {*}
91
+ * @memberof MemoryCache
92
+ */
93
+ ping(message: string, callback?: Function): any;
94
+ /**
95
+ *
96
+ *
97
+ * @param {string} password
98
+ * @param {Function} [callback]
99
+ * @returns {*}
100
+ * @memberof MemoryCache
101
+ */
102
+ auth(password: string, callback?: Function): any;
103
+ /**
104
+ *
105
+ *
106
+ * @param {number} dbIndex
107
+ * @param {Function} [callback]
108
+ * @returns {*}
109
+ * @memberof MemoryCache
110
+ */
111
+ select(dbIndex: number, callback?: Function): any;
112
+ get(key: string, callback?: Function): any;
113
+ /**
114
+ * set(key, value, ttl, pttl, notexist, onlyexist, callback)
115
+ *
116
+ * @param {string} key
117
+ * @param {(string | number)} value
118
+ * @param {...any[]} params
119
+ * @returns {*}
120
+ * @memberof MemoryCache
121
+ */
122
+ set(key: string, value: string | number, ...params: any[]): any;
123
+ /**
124
+ *
125
+ *
126
+ * @param {string} key
127
+ * @param {Function} [callback]
128
+ * @returns {*}
129
+ * @memberof MemoryCache
130
+ */
131
+ ttl(key: string, callback?: Function): any;
132
+ /**
133
+ *
134
+ *
135
+ * @param {string} key
136
+ * @param {number} seconds
137
+ * @param {Function} [callback]
138
+ * @returns {*}
139
+ * @memberof MemoryCache
140
+ */
141
+ expire(key: string, seconds: number, callback?: Function): any;
142
+ /**
143
+ *
144
+ *
145
+ * @param {...any[]} keys
146
+ * @returns {*}
147
+ * @memberof MemoryCache
148
+ */
149
+ del(...keys: any[]): any;
150
+ /**
151
+ *
152
+ *
153
+ * @param {...any[]} keys
154
+ * @returns {*}
155
+ * @memberof MemoryCache
156
+ */
157
+ exists(...keys: any[]): any;
158
+ /**
159
+ *
160
+ *
161
+ * @param {string} key
162
+ * @param {Function} [callback]
163
+ * @returns {*}
164
+ * @memberof MemoryCache
165
+ */
166
+ incr(key: string, callback?: Function): any;
167
+ /**
168
+ *
169
+ *
170
+ * @param {string} key
171
+ * @param {number} amount
172
+ * @param {Function} [callback]
173
+ * @returns {*}
174
+ * @memberof MemoryCache
175
+ */
176
+ incrby(key: string, amount: number, callback?: Function): any;
177
+ /**
178
+ *
179
+ *
180
+ * @param {string} key
181
+ * @param {Function} [callback]
182
+ * @returns {*}
183
+ * @memberof MemoryCache
184
+ */
185
+ decr(key: string, callback?: Function): any;
186
+ /**
187
+ *
188
+ *
189
+ * @param {string} key
190
+ * @param {number} amount
191
+ * @param {Function} [callback]
192
+ * @returns {*}
193
+ * @memberof MemoryCache
194
+ */
195
+ decrby(key: string, amount: number, callback?: Function): any;
196
+ hset(key: string, field: string, value: string | number, callback?: Function): any;
197
+ /**
198
+ *
199
+ *
200
+ * @param {string} key
201
+ * @param {string} field
202
+ * @param {Function} [callback]
203
+ * @returns {*}
204
+ * @memberof MemoryCache
205
+ */
206
+ hget(key: string, field: string, callback?: Function): any;
207
+ /**
208
+ *
209
+ *
210
+ * @param {string} key
211
+ * @param {string} field
212
+ * @param {Function} [callback]
213
+ * @returns {*}
214
+ * @memberof MemoryCache
215
+ */
216
+ hexists(key: string, field: string, callback?: Function): any;
217
+ /**
218
+ *
219
+ *
220
+ * @param {string} key
221
+ * @param {...any[]} fields
222
+ * @returns {*}
223
+ * @memberof MemoryCache
224
+ */
225
+ hdel(key: string, ...fields: any[]): any;
226
+ /**
227
+ *
228
+ *
229
+ * @param {string} key
230
+ * @param {Function} [callback]
231
+ * @returns {*}
232
+ * @memberof MemoryCache
233
+ */
234
+ hlen(key: string, callback?: Function): any;
235
+ /**
236
+ *
237
+ *
238
+ * @param {string} key
239
+ * @param {string} field
240
+ * @param {*} value
241
+ * @param {Function} [callback]
242
+ * @returns {*}
243
+ * @memberof MemoryCache
244
+ */
245
+ hincrby(key: string, field: string, value: any, callback?: Function): any;
246
+ /**
247
+ *
248
+ *
249
+ * @param {string} key
250
+ * @param {Function} [callback]
251
+ * @returns {*}
252
+ * @memberof MemoryCache
253
+ */
254
+ hgetall(key: string, callback?: Function): any;
255
+ /**
256
+ *
257
+ *
258
+ * @param {string} key
259
+ * @param {Function} [callback]
260
+ * @returns {*}
261
+ * @memberof MemoryCache
262
+ */
263
+ hkeys(key: string, callback?: Function): any;
264
+ /**
265
+ *
266
+ *
267
+ * @param {string} key
268
+ * @param {Function} [callback]
269
+ * @returns {*}
270
+ * @memberof MemoryCache
271
+ */
272
+ hvals(key: string, callback?: Function): any;
273
+ /**
274
+ *
275
+ *
276
+ * @param {string} key
277
+ * @param {Function} [callback]
278
+ * @returns {*}
279
+ * @memberof MemoryCache
280
+ */
281
+ llen(key: string, callback?: Function): any;
282
+ /**
283
+ *
284
+ *
285
+ * @param {string} key
286
+ * @param {(string | number)} value
287
+ * @param {Function} [callback]
288
+ * @returns {*}
289
+ * @memberof MemoryCache
290
+ */
291
+ rpush(key: string, value: string | number, callback?: Function): any;
292
+ /**
293
+ *
294
+ *
295
+ * @param {string} key
296
+ * @param {(string | number)} value
297
+ * @param {Function} [callback]
298
+ * @returns {*}
299
+ * @memberof MemoryCache
300
+ */
301
+ lpush(key: string, value: string | number, callback?: Function): any;
302
+ /**
303
+ *
304
+ *
305
+ * @param {string} key
306
+ * @param {Function} [callback]
307
+ * @returns {*}
308
+ * @memberof MemoryCache
309
+ */
310
+ lpop(key: string, callback?: Function): any;
311
+ /**
312
+ *
313
+ *
314
+ * @param {string} key
315
+ * @param {Function} [callback]
316
+ * @returns {*}
317
+ * @memberof MemoryCache
318
+ */
319
+ rpop(key: string, callback?: Function): any;
320
+ /**
321
+ *
322
+ *
323
+ * @param {string} key
324
+ * @param {number} start
325
+ * @param {number} stop
326
+ * @param {Function} [callback]
327
+ * @returns {*}
328
+ * @memberof MemoryCache
329
+ */
330
+ lrange(key: string, start: number, stop: number, callback?: Function): any;
331
+ /**
332
+ *
333
+ *
334
+ * @param {string} key
335
+ * @param {...any[]} members
336
+ * @returns {*}
337
+ * @memberof MemoryCache
338
+ */
339
+ sadd(key: string, ...members: string[]): any;
340
+ /**
341
+ *
342
+ *
343
+ * @param {string} key
344
+ * @param {Function} [callback]
345
+ * @returns {*}
346
+ * @memberof MemoryCache
347
+ */
348
+ scard(key: string, callback?: Function): any;
349
+ /**
350
+ *
351
+ *
352
+ * @param {string} key
353
+ * @param {string} member
354
+ * @param {Function} [callback]
355
+ * @returns {*}
356
+ * @memberof MemoryCache
357
+ */
358
+ sismember(key: string, member: string, callback?: Function): any;
359
+ /**
360
+ *
361
+ *
362
+ * @param {string} key
363
+ * @param {Function} [callback]
364
+ * @returns {*}
365
+ * @memberof MemoryCache
366
+ */
367
+ smembers(key: string, callback?: Function): any;
368
+ /**
369
+ *
370
+ *
371
+ * @param {string} key
372
+ * @param {number} [count]
373
+ * @param {Function} [callback]
374
+ * @returns {*}
375
+ * @memberof MemoryCache
376
+ */
377
+ spop(key: string, count?: number, callback?: Function): any;
378
+ /**
379
+ *
380
+ *
381
+ * @param {string} key
382
+ * @param {...any[]} members
383
+ * @returns {*}
384
+ * @memberof MemoryCache
385
+ */
386
+ srem(key: string, ...members: any[]): any;
387
+ /**
388
+ *
389
+ *
390
+ * @param {string} sourcekey
391
+ * @param {string} destkey
392
+ * @param {string} member
393
+ * @param {Function} [callback]
394
+ * @returns {*}
395
+ * @memberof MemoryCache
396
+ */
397
+ smove(sourcekey: string, destkey: string, member: string, callback?: Function): any;
398
+ discard(callback?: Function, silent?: boolean): any;
399
+ /**
400
+ *
401
+ *
402
+ * @param {string} key
403
+ * @param {Function} [callback]
404
+ * @returns {*}
405
+ * @memberof MemoryCache
406
+ */
407
+ private pttl;
408
+ /**
409
+ *
410
+ *
411
+ * @private
412
+ * @param {string} key
413
+ * @param {Function} [callback]
414
+ * @returns {*}
415
+ * @memberof MemoryCache
416
+ */
417
+ private persist;
418
+ /**
419
+ *
420
+ *
421
+ * @private
422
+ * @param {string} key
423
+ * @returns {*} {boolean}
424
+ * @memberof MemoryCache
425
+ */
426
+ private _hasKey;
427
+ /**
428
+ *
429
+ *
430
+ * @private
431
+ * @param {*} value
432
+ * @param {string} type
433
+ * @param {number} timeout
434
+ * @returns {*}
435
+ * @memberof MemoryCache
436
+ */
437
+ private _makeKey;
438
+ /**
439
+ *
440
+ *
441
+ * @private
442
+ * @param {string} key
443
+ * @returns {*}
444
+ * @memberof MemoryCache
445
+ */
446
+ private _key;
447
+ /**
448
+ *
449
+ *
450
+ * @private
451
+ * @param {string} key
452
+ * @param {number} amount
453
+ * @param {Function} [callback]
454
+ * @returns {*}
455
+ * @memberof MemoryCache
456
+ */
457
+ private _addToKey;
458
+ /**
459
+ *
460
+ *
461
+ * @private
462
+ * @param {string} key
463
+ * @param {string} type
464
+ * @param {boolean} [throwError]
465
+ * @param {Function} [callback]
466
+ * @returns {*}
467
+ * @memberof MemoryCache
468
+ */
469
+ private _testType;
470
+ /**
471
+ *
472
+ *
473
+ * @private
474
+ * @param {string} key
475
+ * @returns {*}
476
+ * @memberof MemoryCache
477
+ */
478
+ private _getKey;
479
+ /**
480
+ *
481
+ *
482
+ * @private
483
+ * @param {string} key
484
+ * @param {(number | string)} value
485
+ * @memberof MemoryCache
486
+ */
487
+ private _setKey;
488
+ /**
489
+ *
490
+ *
491
+ * @private
492
+ * @param {string} key
493
+ * @param {string} field
494
+ * @param {number} [amount]
495
+ * @param {boolean} [useFloat]
496
+ * @param {Function} [callback]
497
+ * @returns {*}
498
+ * @memberof MemoryCache
499
+ */
500
+ private _addToField;
501
+ /**
502
+ *
503
+ *
504
+ * @private
505
+ * @param {string} key
506
+ * @param {string} field
507
+ * @returns {*}
508
+ * @memberof MemoryCache
509
+ */
510
+ private _getField;
511
+ /**
512
+ *
513
+ *
514
+ * @private
515
+ * @param {string} key
516
+ * @param {string} field
517
+ * @returns {*} {boolean}
518
+ * @memberof MemoryCache
519
+ */
520
+ private _hasField;
521
+ /**
522
+ *
523
+ *
524
+ * @param {string} key
525
+ * @param {string} field
526
+ * @param {*} value
527
+ * @memberof MemoryCache
528
+ */
529
+ _setField(key: string, field: string, value: any): void;
530
+ /**
531
+ *
532
+ *
533
+ * @private
534
+ * @param {Function} [callback]
535
+ * @param {(any)} [message]
536
+ * @param {*} [error]
537
+ * @param {boolean} [nolog]
538
+ * @returns {*}
539
+ * @memberof MemoryCache
540
+ */
541
+ private _handleCallback;
542
+ private _logReturn;
543
+ /**
544
+ *
545
+ *
546
+ * @private
547
+ * @param {any[]} [params]
548
+ * @returns {*}
549
+ * @memberof MemoryCache
550
+ */
551
+ private _retrieveCallback;
552
+ }
553
+ export {};