@cacheable/node-cache 2.0.0 → 2.0.1
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 +31 -2
- package/package.json +7 -7
package/README.md
CHANGED
|
@@ -10,18 +10,19 @@
|
|
|
10
10
|
[](https://www.npmjs.com/package/@cacheable/node-cache)
|
|
11
11
|
[](https://github.com/jaredwray/cacheable/blob/main/LICENSE)
|
|
12
12
|
|
|
13
|
-
`@cacheable/node-cache` is compatible with the [node-cache](https://www.npmjs.com/package/node-cache) package with regular maintenance and additional functionality (async/await and storage adapters)
|
|
13
|
+
`@cacheable/node-cache` is compatible with the [node-cache](https://www.npmjs.com/package/node-cache) package with regular maintenance and additional functionality (async/await and storage adapters) via `{NodeCacheStore}`. The only thing not implemented is the `enableLegacyCallbacks` option and functions. If you need them we are happy to take a PR to add them.
|
|
14
14
|
|
|
15
15
|
* Fully Compatible with `node-cache` using `{NodeCache}`
|
|
16
16
|
* Faster than the original `node-cache` package 🚀
|
|
17
|
+
* Storage Adapters via [Keyv](https://keyv.org)
|
|
17
18
|
* Async/Await functionality with `{NodeCacheStore}`
|
|
18
|
-
* Storage Adapters via [Keyv](https://keyv.org) with `{NodeCacheStore}`
|
|
19
19
|
* Lightweight - uses `@cacheable/utils` for utilities
|
|
20
20
|
* Maintained and Updated Regularly! 🎉
|
|
21
21
|
|
|
22
22
|
# Table of Contents
|
|
23
23
|
* [Getting Started](#getting-started)
|
|
24
24
|
* [Basic Usage](#basic-usage)
|
|
25
|
+
* [Breaking Changes from v1 to v2](#breaking-changes-from-v1-to-v2)
|
|
25
26
|
* [NodeCache Performance](#nodecache-performance)
|
|
26
27
|
* [NodeCache API](#nodecache-api)
|
|
27
28
|
* [NodeCacheStore](#nodecachestore)
|
|
@@ -71,6 +72,34 @@ cache.set('foo', 'bar');
|
|
|
71
72
|
cache.get('foo'); // 'bar'
|
|
72
73
|
```
|
|
73
74
|
|
|
75
|
+
# Breaking Changes from v1 to v2
|
|
76
|
+
|
|
77
|
+
The main `NodeCache` class API has not changed and remains fully compatible. The primary internal change is that it now uses Keyv as the underlying store.
|
|
78
|
+
|
|
79
|
+
## NodeCacheStore Changes
|
|
80
|
+
|
|
81
|
+
### Removed `cache` Property
|
|
82
|
+
- **V1**: `nodeCache.cache` returned a `Cacheable` instance
|
|
83
|
+
- **V2**: Use `nodeCache.store` which returns a `Keyv` instance
|
|
84
|
+
|
|
85
|
+
### Removed Storage Tiering (primary/secondary)
|
|
86
|
+
- **V1**: Supported `primary` and `secondary` store options for multi-tier caching
|
|
87
|
+
- **V2**: Uses single `store` option only
|
|
88
|
+
|
|
89
|
+
**Migration:**
|
|
90
|
+
```javascript
|
|
91
|
+
// V1
|
|
92
|
+
const cache = new NodeCacheStore({ primary: keyv1, secondary: keyv2 });
|
|
93
|
+
|
|
94
|
+
// V2 - use single store
|
|
95
|
+
const cache = new NodeCacheStore({ store: keyv });
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
If you need storage tiering functionality, use the `cacheable` package instead which supports primary and secondary stores.
|
|
99
|
+
|
|
100
|
+
### Internal Dependency Change
|
|
101
|
+
- V2 uses `@cacheable/utils` instead of the `cacheable` package for a lighter footprint
|
|
102
|
+
|
|
74
103
|
# NodeCache Performance
|
|
75
104
|
|
|
76
105
|
The performance is comparable if not faster to the original `node-cache` package, but with additional features and improvements.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cacheable/node-cache",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.1",
|
|
4
4
|
"description": "Simple and Maintained fast NodeJS internal caching",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -40,17 +40,17 @@
|
|
|
40
40
|
"cacheable-node"
|
|
41
41
|
],
|
|
42
42
|
"devDependencies": {
|
|
43
|
-
"@biomejs/biome": "^2.3.
|
|
44
|
-
"@faker-js/faker": "^10.
|
|
45
|
-
"@types/node": "^25.0.
|
|
46
|
-
"@vitest/coverage-v8": "^4.0.
|
|
43
|
+
"@biomejs/biome": "^2.3.11",
|
|
44
|
+
"@faker-js/faker": "^10.2.0",
|
|
45
|
+
"@types/node": "^25.0.8",
|
|
46
|
+
"@vitest/coverage-v8": "^4.0.17",
|
|
47
47
|
"rimraf": "^6.1.2",
|
|
48
48
|
"tsup": "^8.5.1",
|
|
49
49
|
"typescript": "^5.9.3",
|
|
50
|
-
"vitest": "^4.0.
|
|
50
|
+
"vitest": "^4.0.17"
|
|
51
51
|
},
|
|
52
52
|
"dependencies": {
|
|
53
|
-
"hookified": "^1.
|
|
53
|
+
"hookified": "^1.15.0",
|
|
54
54
|
"keyv": "^5.5.5",
|
|
55
55
|
"@cacheable/utils": "^2.3.3"
|
|
56
56
|
},
|