Commit 8cf63f3
fix(cache): back the response cache with Redis on cache-manager v7 (#108)
* fix(cache): back the response cache with Redis on cache-manager v7
The cache module was copied from das-gittensor (@nestjs/cache-manager
v2 / cache-manager v5). das-github-mirror is on v3 / cache-manager v7
(Keyv-based), where the config shape changed, so the copied config was
broken on arrival in b771271:
- v3 reads the store list from `stores` (plural Keyv instances); the
singular `store` key was ignored, so Redis was never used.
- v3 reads the entry TTL from top-level `ttl`; the `ttl` nested inside
`redisStore({ ttl })` never reached the cache.
Production therefore ran an in-memory cache with no expiry — GET
responses were pinned from process start and served stale until the
next restart (~20h stale observed on /api/v1/miners/:id/issues).
- Replace cache-manager-redis-yet (v5-era, incompatible with v7) with
@keyv/redis.
- Pass `stores: [Keyv]` + top-level `ttl`.
- Namespace cache keys `apicache`, clear of BullMQ's `bull:*`.
- Add a store error listener so a Redis blip degrades to an uncached
request instead of crashing the process.
- Type the factory return as CacheModuleOptions (was `any`).
* fix(cache): regenerate package-lock.json with npm 10
The previous commit's lockfile was generated with npm 11 (local), which
CI's npm 10 (Node 20) rejected as out of sync — `npm ci` reported the
chokidar subtree missing from the lock. Regenerated with npm 10 so the
lockfile format matches CI; `npm ci` now passes locally under npm 10.
---------
Co-authored-by: anderdc <me@alexanderdc.com>1 parent 1f9e3c3 commit 8cf63f3
3 files changed
Lines changed: 97 additions & 78 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
| 20 | + | |
20 | 21 | | |
21 | 22 | | |
22 | 23 | | |
| |||
26 | 27 | | |
27 | 28 | | |
28 | 29 | | |
29 | | - | |
30 | 30 | | |
| 31 | + | |
31 | 32 | | |
32 | 33 | | |
33 | 34 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
2 | | - | |
| 1 | + | |
| 2 | + | |
3 | 3 | | |
4 | | - | |
| 4 | + | |
| 5 | + | |
5 | 6 | | |
6 | 7 | | |
7 | 8 | | |
| |||
11 | 12 | | |
12 | 13 | | |
13 | 14 | | |
| 15 | + | |
| 16 | + | |
14 | 17 | | |
15 | 18 | | |
16 | 19 | | |
17 | 20 | | |
18 | 21 | | |
19 | | - | |
20 | | - | |
| 22 | + | |
21 | 23 | | |
22 | 24 | | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
23 | 30 | | |
24 | | - | |
25 | | - | |
26 | | - | |
27 | | - | |
28 | | - | |
29 | | - | |
30 | | - | |
31 | | - | |
32 | | - | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
33 | 48 | | |
| 49 | + | |
| 50 | + | |
34 | 51 | | |
35 | 52 | | |
36 | 53 | | |
| |||
0 commit comments