@cacheable/node-cache 1.5.4 → 1.5.6
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.
- package/dist/index.cjs +3 -3
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +3 -3
- package/package.json +10 -10
package/dist/index.cjs
CHANGED
|
@@ -284,7 +284,7 @@ var NodeCache = class extends import_hookified2.Hookified {
|
|
|
284
284
|
expirationTimestamp = ttlValue;
|
|
285
285
|
}
|
|
286
286
|
if (this.options.maxKeys) {
|
|
287
|
-
const maxKeys = this.options
|
|
287
|
+
const { maxKeys } = this.options;
|
|
288
288
|
if (maxKeys > -1 && this.store.size >= maxKeys) {
|
|
289
289
|
throw this.createError("Cache max keys amount exceeded" /* ECACHEFULL */, this.formatKey(key));
|
|
290
290
|
}
|
|
@@ -346,7 +346,7 @@ var NodeCache = class extends import_hookified2.Hookified {
|
|
|
346
346
|
* Gets multiple saved values from the cache. Returns an empty object {} if not found or expired.
|
|
347
347
|
* If the value was found it returns an object with the key value pair.
|
|
348
348
|
* @param {Array<string | number} keys an array of keys
|
|
349
|
-
* @returns {Record<string,
|
|
349
|
+
* @returns {Record<string, T | undefined>} an object with the key as a property and the value as the value
|
|
350
350
|
*/
|
|
351
351
|
mget(keys) {
|
|
352
352
|
const result = {};
|
|
@@ -522,7 +522,7 @@ var NodeCache = class extends import_hookified2.Hookified {
|
|
|
522
522
|
const checkPeriodinSeconds = this.options.checkperiod * 1e3;
|
|
523
523
|
this.intervalId = setInterval(() => {
|
|
524
524
|
this.checkData();
|
|
525
|
-
}, checkPeriodinSeconds);
|
|
525
|
+
}, checkPeriodinSeconds).unref();
|
|
526
526
|
return;
|
|
527
527
|
}
|
|
528
528
|
this.intervalId = 0;
|
package/dist/index.d.cts
CHANGED
|
@@ -235,14 +235,14 @@ declare class NodeCache extends Hookified {
|
|
|
235
235
|
* @param {string | number} key if the key is a number it will convert it to a string
|
|
236
236
|
* @returns {T} the value or undefined
|
|
237
237
|
*/
|
|
238
|
-
get<T>(key: string | number):
|
|
238
|
+
get<T>(key: string | number): T | undefined;
|
|
239
239
|
/**
|
|
240
240
|
* Gets multiple saved values from the cache. Returns an empty object {} if not found or expired.
|
|
241
241
|
* If the value was found it returns an object with the key value pair.
|
|
242
242
|
* @param {Array<string | number} keys an array of keys
|
|
243
|
-
* @returns {Record<string,
|
|
243
|
+
* @returns {Record<string, T | undefined>} an object with the key as a property and the value as the value
|
|
244
244
|
*/
|
|
245
|
-
mget<T>(keys: Array<string | number>): Record<string,
|
|
245
|
+
mget<T>(keys: Array<string | number>): Record<string, T | undefined>;
|
|
246
246
|
/**
|
|
247
247
|
* Get the cached value and remove the key from the cache. Equivalent to calling get(key) + del(key).
|
|
248
248
|
* Useful for implementing single use mechanism such as OTP, where once a value is read it will become obsolete.
|
package/dist/index.d.ts
CHANGED
|
@@ -235,14 +235,14 @@ declare class NodeCache extends Hookified {
|
|
|
235
235
|
* @param {string | number} key if the key is a number it will convert it to a string
|
|
236
236
|
* @returns {T} the value or undefined
|
|
237
237
|
*/
|
|
238
|
-
get<T>(key: string | number):
|
|
238
|
+
get<T>(key: string | number): T | undefined;
|
|
239
239
|
/**
|
|
240
240
|
* Gets multiple saved values from the cache. Returns an empty object {} if not found or expired.
|
|
241
241
|
* If the value was found it returns an object with the key value pair.
|
|
242
242
|
* @param {Array<string | number} keys an array of keys
|
|
243
|
-
* @returns {Record<string,
|
|
243
|
+
* @returns {Record<string, T | undefined>} an object with the key as a property and the value as the value
|
|
244
244
|
*/
|
|
245
|
-
mget<T>(keys: Array<string | number>): Record<string,
|
|
245
|
+
mget<T>(keys: Array<string | number>): Record<string, T | undefined>;
|
|
246
246
|
/**
|
|
247
247
|
* Get the cached value and remove the key from the cache. Equivalent to calling get(key) + del(key).
|
|
248
248
|
* Useful for implementing single use mechanism such as OTP, where once a value is read it will become obsolete.
|
package/dist/index.js
CHANGED
|
@@ -257,7 +257,7 @@ var NodeCache = class extends Hookified2 {
|
|
|
257
257
|
expirationTimestamp = ttlValue;
|
|
258
258
|
}
|
|
259
259
|
if (this.options.maxKeys) {
|
|
260
|
-
const maxKeys = this.options
|
|
260
|
+
const { maxKeys } = this.options;
|
|
261
261
|
if (maxKeys > -1 && this.store.size >= maxKeys) {
|
|
262
262
|
throw this.createError("Cache max keys amount exceeded" /* ECACHEFULL */, this.formatKey(key));
|
|
263
263
|
}
|
|
@@ -319,7 +319,7 @@ var NodeCache = class extends Hookified2 {
|
|
|
319
319
|
* Gets multiple saved values from the cache. Returns an empty object {} if not found or expired.
|
|
320
320
|
* If the value was found it returns an object with the key value pair.
|
|
321
321
|
* @param {Array<string | number} keys an array of keys
|
|
322
|
-
* @returns {Record<string,
|
|
322
|
+
* @returns {Record<string, T | undefined>} an object with the key as a property and the value as the value
|
|
323
323
|
*/
|
|
324
324
|
mget(keys) {
|
|
325
325
|
const result = {};
|
|
@@ -495,7 +495,7 @@ var NodeCache = class extends Hookified2 {
|
|
|
495
495
|
const checkPeriodinSeconds = this.options.checkperiod * 1e3;
|
|
496
496
|
this.intervalId = setInterval(() => {
|
|
497
497
|
this.checkData();
|
|
498
|
-
}, checkPeriodinSeconds);
|
|
498
|
+
}, checkPeriodinSeconds).unref();
|
|
499
499
|
return;
|
|
500
500
|
}
|
|
501
501
|
this.intervalId = 0;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cacheable/node-cache",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.6",
|
|
4
4
|
"description": "Simple and Maintained fast NodeJS internal caching",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -31,18 +31,18 @@
|
|
|
31
31
|
"cacheable-node"
|
|
32
32
|
],
|
|
33
33
|
"devDependencies": {
|
|
34
|
-
"@types/node": "^22.
|
|
35
|
-
"@vitest/coverage-v8": "^3.
|
|
34
|
+
"@types/node": "^22.15.30",
|
|
35
|
+
"@vitest/coverage-v8": "^3.2.2",
|
|
36
36
|
"rimraf": "^6.0.1",
|
|
37
|
-
"tsup": "^8.
|
|
38
|
-
"typescript": "^5.8.
|
|
39
|
-
"vitest": "^3.
|
|
40
|
-
"xo": "^
|
|
37
|
+
"tsup": "^8.5.0",
|
|
38
|
+
"typescript": "^5.8.3",
|
|
39
|
+
"vitest": "^3.2.2",
|
|
40
|
+
"xo": "^1.1.0"
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"hookified": "^1.
|
|
44
|
-
"keyv": "^5.3.
|
|
45
|
-
"cacheable": "^1.
|
|
43
|
+
"hookified": "^1.9.1",
|
|
44
|
+
"keyv": "^5.3.3",
|
|
45
|
+
"cacheable": "^1.10.0"
|
|
46
46
|
},
|
|
47
47
|
"files": [
|
|
48
48
|
"dist",
|