@cacheable/node-cache 1.7.0 → 1.7.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.
- package/README.md +2 -2
- package/dist/index.cjs +1 -4
- package/dist/index.js +4 -7
- package/package.json +10 -8
package/README.md
CHANGED
|
@@ -290,13 +290,13 @@ await cache.get('foo'); // 'bar'
|
|
|
290
290
|
Here is an example of how to use the `NodeCacheStore` with a primary and secondary storage adapter:
|
|
291
291
|
|
|
292
292
|
```javascript
|
|
293
|
-
import {
|
|
293
|
+
import {NodeCacheStore} from '@cacheable/node-cache';
|
|
294
294
|
import {Keyv} from 'keyv';
|
|
295
295
|
import {KeyvRedis} from '@keyv/redis';
|
|
296
296
|
|
|
297
297
|
const primary = new Keyv(); // In-memory storage as primary
|
|
298
298
|
const secondary = new Keyv({store: new KeyvRedis('redis://user:pass@localhost:6379')});
|
|
299
|
-
const cache = new
|
|
299
|
+
const cache = new NodeCacheStore({primary, secondary});
|
|
300
300
|
|
|
301
301
|
// with storage you have the same functionality as the NodeCache but will be using async/await
|
|
302
302
|
await cache.set('foo', 'bar');
|
package/dist/index.cjs
CHANGED
|
@@ -32,12 +32,9 @@ var import_hookified2 = require("hookified");
|
|
|
32
32
|
// src/store.ts
|
|
33
33
|
var import_cacheable = require("cacheable");
|
|
34
34
|
var import_hookified = require("hookified");
|
|
35
|
-
var import_keyv = require("keyv");
|
|
36
35
|
var NodeCacheStore = class extends import_hookified.Hookified {
|
|
37
36
|
_maxKeys = 0;
|
|
38
|
-
_cache = new import_cacheable.Cacheable(
|
|
39
|
-
primary: new import_keyv.Keyv({ store: new import_cacheable.CacheableMemory() })
|
|
40
|
-
});
|
|
37
|
+
_cache = new import_cacheable.Cacheable();
|
|
41
38
|
constructor(options) {
|
|
42
39
|
super();
|
|
43
40
|
if (options) {
|
package/dist/index.js
CHANGED
|
@@ -1,16 +1,13 @@
|
|
|
1
1
|
// src/index.ts
|
|
2
|
-
import { CacheableMemory
|
|
2
|
+
import { CacheableMemory, CacheableStats, shorthandToTime } from "cacheable";
|
|
3
3
|
import { Hookified as Hookified2 } from "hookified";
|
|
4
4
|
|
|
5
5
|
// src/store.ts
|
|
6
|
-
import { Cacheable
|
|
6
|
+
import { Cacheable } from "cacheable";
|
|
7
7
|
import { Hookified } from "hookified";
|
|
8
|
-
import { Keyv } from "keyv";
|
|
9
8
|
var NodeCacheStore = class extends Hookified {
|
|
10
9
|
_maxKeys = 0;
|
|
11
|
-
_cache = new Cacheable(
|
|
12
|
-
primary: new Keyv({ store: new CacheableMemory() })
|
|
13
|
-
});
|
|
10
|
+
_cache = new Cacheable();
|
|
14
11
|
constructor(options) {
|
|
15
12
|
super();
|
|
16
13
|
if (options) {
|
|
@@ -226,7 +223,7 @@ var NodeCache = class extends Hookified2 {
|
|
|
226
223
|
};
|
|
227
224
|
store = /* @__PURE__ */ new Map();
|
|
228
225
|
_stats = new CacheableStats({ enabled: true });
|
|
229
|
-
_cacheable = new
|
|
226
|
+
_cacheable = new CacheableMemory();
|
|
230
227
|
intervalId = 0;
|
|
231
228
|
constructor(options) {
|
|
232
229
|
super();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cacheable/node-cache",
|
|
3
|
-
"version": "1.7.
|
|
3
|
+
"version": "1.7.2",
|
|
4
4
|
"description": "Simple and Maintained fast NodeJS internal caching",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -34,8 +34,9 @@
|
|
|
34
34
|
"cacheable-node"
|
|
35
35
|
],
|
|
36
36
|
"devDependencies": {
|
|
37
|
-
"@biomejs/biome": "^2.2.
|
|
38
|
-
"@
|
|
37
|
+
"@biomejs/biome": "^2.2.4",
|
|
38
|
+
"@faker-js/faker": "^10.0.0",
|
|
39
|
+
"@types/node": "^24.5.0",
|
|
39
40
|
"@vitest/coverage-v8": "^3.2.4",
|
|
40
41
|
"rimraf": "^6.0.1",
|
|
41
42
|
"tsup": "^8.5.0",
|
|
@@ -43,9 +44,9 @@
|
|
|
43
44
|
"vitest": "^3.2.4"
|
|
44
45
|
},
|
|
45
46
|
"dependencies": {
|
|
46
|
-
"hookified": "^1.
|
|
47
|
-
"keyv": "^5.5.
|
|
48
|
-
"cacheable": "^
|
|
47
|
+
"hookified": "^1.12.0",
|
|
48
|
+
"keyv": "^5.5.2",
|
|
49
|
+
"cacheable": "^2.0.2"
|
|
49
50
|
},
|
|
50
51
|
"files": [
|
|
51
52
|
"dist",
|
|
@@ -54,8 +55,9 @@
|
|
|
54
55
|
"scripts": {
|
|
55
56
|
"build": "rimraf ./dist && tsup src/index.ts --format cjs,esm --dts --clean",
|
|
56
57
|
"prepublish": "pnpm build",
|
|
57
|
-
"
|
|
58
|
-
"test
|
|
58
|
+
"lint": "biome check --write --error-on-warnings",
|
|
59
|
+
"test": "pnpm lint && vitest run --coverage",
|
|
60
|
+
"test:ci": "biome check --error-on-warnings && vitest run --coverage",
|
|
59
61
|
"clean": "rimraf ./dist ./coverage ./node_modules"
|
|
60
62
|
}
|
|
61
63
|
}
|