cache-manager 6.4.1 → 6.4.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.
Files changed (2) hide show
  1. package/README.md +41 -0
  2. package/package.json +8 -8
package/README.md CHANGED
@@ -24,6 +24,47 @@ If you are looking for older documentation you can find it here:
24
24
  * [v5 Documentation](https://github.com/jaredwray/cacheable/blob/main/packages/cache-manager/READMEv5.md)
25
25
  * [v4 Documentation](https://github.com/jaredwray/cacheable/blob/main/packages/cache-manager/READMEv4.md)
26
26
 
27
+ # Migration from v5 to v6
28
+
29
+ `v6` is a major update and has breaking changes primarily around the storage adapters. We have moved to using [Keyv](https://keyv.org/) which are more actively maintained and have a larger community. Below are the changes you need to make to migrate from `v5` to `v6`. In `v5` the `memoryStore` was used to create a memory store, in `v6` you can use any storage adapter that Keyv supports. Below is an example of how to migrate from `v5` to `v6`:
30
+
31
+ ```ts
32
+ import { createCache, memoryStore } from 'cache-manager';
33
+
34
+ // Create memory cache synchronously
35
+ const memoryCache = createCache(memoryStore({
36
+ max: 100,
37
+ ttl: 10 * 1000 /*milliseconds*/,
38
+ }));
39
+ ```
40
+
41
+ In `v6` you can use any storage adapter that Keyv supports. Below is an example of how to migrate from `v5` to `v6` using `CacheableMemory` from Cacheable:
42
+
43
+ ```ts
44
+ import { createCache } from 'cache-manager';
45
+ import { Keyv } from 'keyv';
46
+
47
+ const cache = createCache({
48
+ stores: [new Keyv()],
49
+ });
50
+ ```
51
+
52
+ If you would like a more robust in memory storage adapter you can use `CacheableMemory` from Cacheable. Below is an example of how to migrate from `v5` to `v6` using `CacheableMemory`:
53
+
54
+ ```ts
55
+ import { createCache } from 'cache-manager';
56
+ import { KeyvCacheableMemory } from 'cacheable';
57
+
58
+ const cache = createCache({
59
+ stores: [new KeyvCacheableMemory({ ttl: 60000, lruSize: 5000 })],
60
+ });
61
+ ```
62
+
63
+ To learn more about `CacheableMemory` please visit: http://cacheable.org/docs/cacheable/#cacheablememory---in-memory-cache
64
+
65
+ If you are still wanting to use the legacy storage adapters you can use the `KeyvAdapter` to wrap the storage adapter. Below is an example of how to migrate from `v5` to `v6` using `cache-manager-redis-yet` by going to [Using Legacy Storage Adapters](#using-legacy-storage-adapters).
66
+
67
+
27
68
  ## Table of Contents
28
69
  * [Installation](#installation)
29
70
  * [Quick start](#quick-start)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cache-manager",
3
- "version": "6.4.1",
3
+ "version": "6.4.2",
4
4
  "description": "Cache Manager for Node.js",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
@@ -50,20 +50,20 @@
50
50
  ],
51
51
  "license": "MIT",
52
52
  "dependencies": {
53
- "keyv": "^5.3.1"
53
+ "keyv": "^5.3.2"
54
54
  },
55
55
  "devDependencies": {
56
- "@faker-js/faker": "^9.5.1",
57
- "@keyv/redis": "^4.3.1",
58
- "@types/node": "^22.13.9",
59
- "@vitest/coverage-v8": "^3.0.7",
56
+ "@faker-js/faker": "^9.6.0",
57
+ "@keyv/redis": "^4.3.2",
58
+ "@types/node": "^22.14.0",
59
+ "@vitest/coverage-v8": "^3.1.1",
60
60
  "cache-manager-redis-yet": "^5.1.5",
61
61
  "rimraf": "^6.0.1",
62
62
  "tsup": "^8.4.0",
63
63
  "typescript": "^5.8.2",
64
- "vitest": "^3.0.7",
64
+ "vitest": "^3.1.1",
65
65
  "xo": "^0.60.0",
66
- "cacheable": "^1.8.9"
66
+ "cacheable": "^1.8.10"
67
67
  },
68
68
  "xo": {
69
69
  "rules": {