@cacheable/node-cache 1.7.5 → 1.7.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 +16 -16
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +16 -16
- package/package.json +18 -12
package/dist/index.cjs
CHANGED
|
@@ -511,6 +511,22 @@ var NodeCache = class extends import_hookified2.Hookified {
|
|
|
511
511
|
getIntervalId() {
|
|
512
512
|
return this.intervalId;
|
|
513
513
|
}
|
|
514
|
+
startInterval() {
|
|
515
|
+
if (this.options.checkperiod && this.options.checkperiod > 0) {
|
|
516
|
+
const checkPeriodinSeconds = this.options.checkperiod * 1e3;
|
|
517
|
+
this.intervalId = setInterval(() => {
|
|
518
|
+
this.checkData();
|
|
519
|
+
}, checkPeriodinSeconds).unref();
|
|
520
|
+
return;
|
|
521
|
+
}
|
|
522
|
+
this.intervalId = 0;
|
|
523
|
+
}
|
|
524
|
+
stopInterval() {
|
|
525
|
+
if (this.intervalId !== 0) {
|
|
526
|
+
clearInterval(this.intervalId);
|
|
527
|
+
this.intervalId = 0;
|
|
528
|
+
}
|
|
529
|
+
}
|
|
514
530
|
formatKey(key) {
|
|
515
531
|
return key.toString();
|
|
516
532
|
}
|
|
@@ -523,16 +539,6 @@ var NodeCache = class extends import_hookified2.Hookified {
|
|
|
523
539
|
const expirationTimestamp = currentTimestamp + ttlInMilliseconds;
|
|
524
540
|
return expirationTimestamp;
|
|
525
541
|
}
|
|
526
|
-
startInterval() {
|
|
527
|
-
if (this.options.checkperiod && this.options.checkperiod > 0) {
|
|
528
|
-
const checkPeriodinSeconds = this.options.checkperiod * 1e3;
|
|
529
|
-
this.intervalId = setInterval(() => {
|
|
530
|
-
this.checkData();
|
|
531
|
-
}, checkPeriodinSeconds).unref();
|
|
532
|
-
return;
|
|
533
|
-
}
|
|
534
|
-
this.intervalId = 0;
|
|
535
|
-
}
|
|
536
542
|
checkData() {
|
|
537
543
|
for (const [key, value] of this.store.entries()) {
|
|
538
544
|
if (value.ttl > 0 && value.ttl < Date.now()) {
|
|
@@ -543,12 +549,6 @@ var NodeCache = class extends import_hookified2.Hookified {
|
|
|
543
549
|
}
|
|
544
550
|
}
|
|
545
551
|
}
|
|
546
|
-
stopInterval() {
|
|
547
|
-
if (this.intervalId !== 0) {
|
|
548
|
-
clearInterval(this.intervalId);
|
|
549
|
-
this.intervalId = 0;
|
|
550
|
-
}
|
|
551
|
-
}
|
|
552
552
|
createError(errorCode, key) {
|
|
553
553
|
let error = errorCode;
|
|
554
554
|
if (key) {
|
package/dist/index.d.cts
CHANGED
|
@@ -324,11 +324,11 @@ declare class NodeCache<T> extends Hookified {
|
|
|
324
324
|
* @returns {number | NodeJS.Timeout} the interval id
|
|
325
325
|
*/
|
|
326
326
|
getIntervalId(): number | NodeJS.Timeout;
|
|
327
|
+
startInterval(): void;
|
|
328
|
+
stopInterval(): void;
|
|
327
329
|
private formatKey;
|
|
328
330
|
private getExpirationTimestamp;
|
|
329
|
-
private startInterval;
|
|
330
331
|
private checkData;
|
|
331
|
-
private stopInterval;
|
|
332
332
|
private createError;
|
|
333
333
|
}
|
|
334
334
|
|
package/dist/index.d.ts
CHANGED
|
@@ -324,11 +324,11 @@ declare class NodeCache<T> extends Hookified {
|
|
|
324
324
|
* @returns {number | NodeJS.Timeout} the interval id
|
|
325
325
|
*/
|
|
326
326
|
getIntervalId(): number | NodeJS.Timeout;
|
|
327
|
+
startInterval(): void;
|
|
328
|
+
stopInterval(): void;
|
|
327
329
|
private formatKey;
|
|
328
330
|
private getExpirationTimestamp;
|
|
329
|
-
private startInterval;
|
|
330
331
|
private checkData;
|
|
331
|
-
private stopInterval;
|
|
332
332
|
private createError;
|
|
333
333
|
}
|
|
334
334
|
|
package/dist/index.js
CHANGED
|
@@ -484,6 +484,22 @@ var NodeCache = class extends Hookified2 {
|
|
|
484
484
|
getIntervalId() {
|
|
485
485
|
return this.intervalId;
|
|
486
486
|
}
|
|
487
|
+
startInterval() {
|
|
488
|
+
if (this.options.checkperiod && this.options.checkperiod > 0) {
|
|
489
|
+
const checkPeriodinSeconds = this.options.checkperiod * 1e3;
|
|
490
|
+
this.intervalId = setInterval(() => {
|
|
491
|
+
this.checkData();
|
|
492
|
+
}, checkPeriodinSeconds).unref();
|
|
493
|
+
return;
|
|
494
|
+
}
|
|
495
|
+
this.intervalId = 0;
|
|
496
|
+
}
|
|
497
|
+
stopInterval() {
|
|
498
|
+
if (this.intervalId !== 0) {
|
|
499
|
+
clearInterval(this.intervalId);
|
|
500
|
+
this.intervalId = 0;
|
|
501
|
+
}
|
|
502
|
+
}
|
|
487
503
|
formatKey(key) {
|
|
488
504
|
return key.toString();
|
|
489
505
|
}
|
|
@@ -496,16 +512,6 @@ var NodeCache = class extends Hookified2 {
|
|
|
496
512
|
const expirationTimestamp = currentTimestamp + ttlInMilliseconds;
|
|
497
513
|
return expirationTimestamp;
|
|
498
514
|
}
|
|
499
|
-
startInterval() {
|
|
500
|
-
if (this.options.checkperiod && this.options.checkperiod > 0) {
|
|
501
|
-
const checkPeriodinSeconds = this.options.checkperiod * 1e3;
|
|
502
|
-
this.intervalId = setInterval(() => {
|
|
503
|
-
this.checkData();
|
|
504
|
-
}, checkPeriodinSeconds).unref();
|
|
505
|
-
return;
|
|
506
|
-
}
|
|
507
|
-
this.intervalId = 0;
|
|
508
|
-
}
|
|
509
515
|
checkData() {
|
|
510
516
|
for (const [key, value] of this.store.entries()) {
|
|
511
517
|
if (value.ttl > 0 && value.ttl < Date.now()) {
|
|
@@ -516,12 +522,6 @@ var NodeCache = class extends Hookified2 {
|
|
|
516
522
|
}
|
|
517
523
|
}
|
|
518
524
|
}
|
|
519
|
-
stopInterval() {
|
|
520
|
-
if (this.intervalId !== 0) {
|
|
521
|
-
clearInterval(this.intervalId);
|
|
522
|
-
this.intervalId = 0;
|
|
523
|
-
}
|
|
524
|
-
}
|
|
525
525
|
createError(errorCode, key) {
|
|
526
526
|
let error = errorCode;
|
|
527
527
|
if (key) {
|
package/package.json
CHANGED
|
@@ -1,15 +1,21 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cacheable/node-cache",
|
|
3
|
-
"version": "1.7.
|
|
3
|
+
"version": "1.7.6",
|
|
4
4
|
"description": "Simple and Maintained fast NodeJS internal caching",
|
|
5
5
|
"type": "module",
|
|
6
|
-
"main": "./dist/index.
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
7
|
"module": "./dist/index.js",
|
|
8
8
|
"types": "./dist/index.d.ts",
|
|
9
9
|
"exports": {
|
|
10
10
|
".": {
|
|
11
|
-
"
|
|
12
|
-
|
|
11
|
+
"import": {
|
|
12
|
+
"types": "./dist/index.d.ts",
|
|
13
|
+
"default": "./dist/index.js"
|
|
14
|
+
},
|
|
15
|
+
"require": {
|
|
16
|
+
"types": "./dist/index.d.cts",
|
|
17
|
+
"default": "./dist/index.cjs"
|
|
18
|
+
}
|
|
13
19
|
}
|
|
14
20
|
},
|
|
15
21
|
"engines": {
|
|
@@ -34,19 +40,19 @@
|
|
|
34
40
|
"cacheable-node"
|
|
35
41
|
],
|
|
36
42
|
"devDependencies": {
|
|
37
|
-
"@biomejs/biome": "^2.3.
|
|
43
|
+
"@biomejs/biome": "^2.3.8",
|
|
38
44
|
"@faker-js/faker": "^10.1.0",
|
|
39
|
-
"@types/node": "^
|
|
40
|
-
"@vitest/coverage-v8": "^4.0.
|
|
41
|
-
"rimraf": "^6.1.
|
|
45
|
+
"@types/node": "^25.0.2",
|
|
46
|
+
"@vitest/coverage-v8": "^4.0.15",
|
|
47
|
+
"rimraf": "^6.1.2",
|
|
42
48
|
"tsup": "^8.5.1",
|
|
43
49
|
"typescript": "^5.9.3",
|
|
44
|
-
"vitest": "^4.0.
|
|
50
|
+
"vitest": "^4.0.15"
|
|
45
51
|
},
|
|
46
52
|
"dependencies": {
|
|
47
|
-
"hookified": "^1.
|
|
48
|
-
"keyv": "^5.5.
|
|
49
|
-
"cacheable": "^2.
|
|
53
|
+
"hookified": "^1.14.0",
|
|
54
|
+
"keyv": "^5.5.5",
|
|
55
|
+
"cacheable": "^2.3.1"
|
|
50
56
|
},
|
|
51
57
|
"files": [
|
|
52
58
|
"dist",
|