@cacheable/node-cache
Advanced tools
+7
-7
| { | ||
| "name": "@cacheable/node-cache", | ||
| "version": "2.0.0", | ||
| "version": "2.0.1", | ||
| "description": "Simple and Maintained fast NodeJS internal caching", | ||
@@ -43,13 +43,13 @@ "type": "module", | ||
| "devDependencies": { | ||
| "@biomejs/biome": "^2.3.8", | ||
| "@faker-js/faker": "^10.1.0", | ||
| "@types/node": "^25.0.2", | ||
| "@vitest/coverage-v8": "^4.0.15", | ||
| "@biomejs/biome": "^2.3.11", | ||
| "@faker-js/faker": "^10.2.0", | ||
| "@types/node": "^25.0.8", | ||
| "@vitest/coverage-v8": "^4.0.17", | ||
| "rimraf": "^6.1.2", | ||
| "tsup": "^8.5.1", | ||
| "typescript": "^5.9.3", | ||
| "vitest": "^4.0.15" | ||
| "vitest": "^4.0.17" | ||
| }, | ||
| "dependencies": { | ||
| "hookified": "^1.14.0", | ||
| "hookified": "^1.15.0", | ||
| "keyv": "^5.5.5", | ||
@@ -56,0 +56,0 @@ "@cacheable/utils": "^2.3.3" |
+31
-2
@@ -13,8 +13,8 @@ [<img align="center" src="https://cacheable.org/symbol.svg" alt="Cacheable" />](https://github.com/jaredwray/cacheable) | ||
| `@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). 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. | ||
| `@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. | ||
| * Fully Compatible with `node-cache` using `{NodeCache}` | ||
| * Faster than the original `node-cache` package 🚀 | ||
| * Storage Adapters via [Keyv](https://keyv.org) | ||
| * Async/Await functionality with `{NodeCacheStore}` | ||
| * Storage Adapters via [Keyv](https://keyv.org) with `{NodeCacheStore}` | ||
| * Lightweight - uses `@cacheable/utils` for utilities | ||
@@ -26,2 +26,3 @@ * Maintained and Updated Regularly! 🎉 | ||
| * [Basic Usage](#basic-usage) | ||
| * [Breaking Changes from v1 to v2](#breaking-changes-from-v1-to-v2) | ||
| * [NodeCache Performance](#nodecache-performance) | ||
@@ -76,2 +77,30 @@ * [NodeCache API](#nodecache-api) | ||
| # Breaking Changes from v1 to v2 | ||
| 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. | ||
| ## NodeCacheStore Changes | ||
| ### Removed `cache` Property | ||
| - **V1**: `nodeCache.cache` returned a `Cacheable` instance | ||
| - **V2**: Use `nodeCache.store` which returns a `Keyv` instance | ||
| ### Removed Storage Tiering (primary/secondary) | ||
| - **V1**: Supported `primary` and `secondary` store options for multi-tier caching | ||
| - **V2**: Uses single `store` option only | ||
| **Migration:** | ||
| ```javascript | ||
| // V1 | ||
| const cache = new NodeCacheStore({ primary: keyv1, secondary: keyv2 }); | ||
| // V2 - use single store | ||
| const cache = new NodeCacheStore({ store: keyv }); | ||
| ``` | ||
| If you need storage tiering functionality, use the `cacheable` package instead which supports primary and secondary stores. | ||
| ### Internal Dependency Change | ||
| - V2 uses `@cacheable/utils` instead of the `cacheable` package for a lighter footprint | ||
| # NodeCache Performance | ||
@@ -78,0 +107,0 @@ |
75093
1.41%376
8.36%Updated