tricache 1.0.1 → 1.0.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 (96) hide show
  1. package/README.md +36 -28
  2. package/dist/{cache-service-CREOp7MM.d.ts → cache-service-B108FzER.d.ts} +36 -4
  3. package/dist/cache-service-CWI4jkS7.d.cts +963 -0
  4. package/dist/{cache-service-MG7PN6MX.js → cache-service-GYPZFB7O.js} +2 -2
  5. package/dist/{chunk-IITRFWHY.js → chunk-EUKB7RKP.js} +21 -4
  6. package/dist/{chunk-2AJKEQMZ.js → chunk-H4GFLQ26.js} +7 -4
  7. package/dist/{chunk-7RV5ZVBB.js → chunk-JNSLMK4Q.js} +111 -29
  8. package/dist/chunk-OYDU3SMI.js +89 -0
  9. package/dist/{chunk-3I5L7K6I.js → chunk-VNRDL5RA.js} +102 -140
  10. package/dist/{chunk-JYQFQJNJ.js → chunk-WYF7NOAT.js} +1443 -609
  11. package/dist/cli.cjs +1367 -625
  12. package/dist/cli.d.cts +12 -0
  13. package/dist/cli.js +27 -6
  14. package/dist/dashboard/index.cjs +111 -29
  15. package/dist/dashboard/index.d.cts +185 -0
  16. package/dist/dashboard/index.d.ts +5 -3
  17. package/dist/dashboard/index.js +1 -1
  18. package/dist/drizzle/index.cjs +1370 -624
  19. package/dist/drizzle/index.d.cts +46 -0
  20. package/dist/drizzle/index.d.ts +2 -2
  21. package/dist/drizzle/index.js +1 -1
  22. package/dist/edge/index.cjs +227 -123
  23. package/dist/edge/index.d.cts +127 -0
  24. package/dist/edge/index.d.ts +3 -3
  25. package/dist/edge/index.js +201 -117
  26. package/dist/hono/index.cjs +1418 -644
  27. package/dist/hono/index.d.cts +93 -0
  28. package/dist/hono/index.d.ts +7 -5
  29. package/dist/hono/index.js +16 -9
  30. package/dist/{hono-DSV2ve66.d.ts → hono-3rDMYVtY.d.ts} +16 -3
  31. package/dist/hono-C886ok3X.d.cts +391 -0
  32. package/dist/http/index.cjs +1514 -679
  33. package/dist/http/index.d.cts +103 -0
  34. package/dist/http/index.d.ts +13 -5
  35. package/dist/http/index.js +92 -43
  36. package/dist/index.cjs +1671 -790
  37. package/dist/index.d.cts +1006 -0
  38. package/dist/index.d.ts +39 -8
  39. package/dist/index.js +8 -8
  40. package/dist/murmur3-CMGw9PbV.d.cts +98 -0
  41. package/dist/nestjs/index.cjs +1454 -649
  42. package/dist/nestjs/index.d.cts +285 -0
  43. package/dist/nestjs/index.d.ts +103 -30
  44. package/dist/nestjs/index.js +115 -32
  45. package/dist/next/index.cjs +1512 -718
  46. package/dist/next/index.d.cts +232 -0
  47. package/dist/next/index.d.ts +33 -11
  48. package/dist/next/index.js +172 -99
  49. package/dist/prisma/index.cjs +11 -1
  50. package/dist/prisma/index.d.cts +62 -0
  51. package/dist/prisma/index.d.ts +2 -2
  52. package/dist/prisma/index.js +11 -1
  53. package/dist/serialize-worker.d.cts +2 -0
  54. package/dist/{types-Dyip5wAl.d.ts → types-BA4pz1A0.d.cts} +24 -9
  55. package/dist/types-BA4pz1A0.d.ts +1519 -0
  56. package/dist/{utils-CEsU_Z0s.d.ts → utils-Bvzn-rKS.d.cts} +3 -1
  57. package/dist/utils-Bvzn-rKS.d.ts +29 -0
  58. package/package.json +96 -36
  59. package/src/adapters/auto-pipeliner.ts +107 -24
  60. package/src/adapters/node-redis.ts +106 -27
  61. package/src/cache-service.ts +802 -502
  62. package/src/cli.ts +24 -6
  63. package/src/cross-region.ts +21 -3
  64. package/src/dashboard/handler.ts +26 -6
  65. package/src/dashboard/html.ts +35 -10
  66. package/src/dashboard/index.ts +35 -13
  67. package/src/dashboard/types.ts +3 -1
  68. package/src/disk-tier.ts +171 -65
  69. package/src/edge/cache.ts +145 -97
  70. package/src/edge/hono.ts +23 -6
  71. package/src/edge/types.ts +2 -0
  72. package/src/hono/index.ts +19 -9
  73. package/src/http/express.ts +62 -17
  74. package/src/http/fastify.ts +35 -21
  75. package/src/http/utils.ts +54 -20
  76. package/src/ipc-telemetry.ts +35 -9
  77. package/src/nestjs/decorators.ts +1 -1
  78. package/src/nestjs/index.ts +2 -0
  79. package/src/nestjs/keyv-adapter.ts +68 -0
  80. package/src/nestjs/tricache.module.ts +13 -11
  81. package/src/nestjs/tricache.store.ts +51 -20
  82. package/src/nestjs/types.ts +29 -15
  83. package/src/next/cache-handler.ts +131 -53
  84. package/src/next/index.ts +1 -0
  85. package/src/next/types.ts +21 -0
  86. package/src/prisma/index.ts +12 -1
  87. package/src/smart-memory-cache.ts +63 -26
  88. package/src/types.ts +25 -2
  89. package/src/utils/cgroup.ts +12 -0
  90. package/src/utils/deadline.ts +14 -0
  91. package/src/utils/diagnostics.ts +27 -0
  92. package/src/utils/redis-slot.ts +13 -0
  93. package/src/wasm/bloom-filter-wasm.ts +9 -4
  94. package/src/worker-pool.ts +17 -8
  95. package/src/wtiny-lfu.ts +20 -6
  96. package/dist/chunk-BQRURGGD.js +0 -60
package/README.md CHANGED
@@ -4,7 +4,7 @@
4
4
  [![Docs](https://img.shields.io/badge/docs-VitePress-blue.svg)](https://kareem411.github.io/TriCache/)
5
5
  [![npm version](https://img.shields.io/npm/v/tricache.svg)](https://www.npmjs.com/package/tricache)
6
6
  [![npm downloads](https://img.shields.io/npm/dm/tricache.svg)](https://www.npmjs.com/package/tricache)
7
- [![Tests](https://img.shields.io/badge/tests-926%20passing-brightgreen)](tests)
7
+ [![Tests](https://img.shields.io/badge/tests-980%20passing-brightgreen)](tests)
8
8
  [![Code Quality](https://img.shields.io/badge/oxlint-0%20warnings-brightgreen)](src)
9
9
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)
10
10
  [![Node.js ≥ 20](https://img.shields.io/badge/node-%3E%3D20-brightgreen)](https://nodejs.org)
@@ -12,7 +12,7 @@
12
12
  > 🌐 **Documentation Site**: **[https://kareem411.github.io/TriCache/](https://kareem411.github.io/TriCache/)**
13
13
  > 📦 **npm Package**: **[`npm install tricache`](https://www.npmjs.com/package/tricache)**
14
14
 
15
- **TriCache** is an enterprise three-tier caching engine for Node.js: **L1 RAM** $\rightarrow$ **L1.5 Off-Heap `/dev/shm`** $\rightarrow$ **L2 Redis/Valkey**. Warm in-memory reads run at **2.81 million ops/sec (356 ns/op)**. By absorbing 95%+ of queries locally in zero-GC POSIX shared memory with Singleflight stampede coalescing, TriCache slashes cloud Redis bills and latency without risking stale data.
15
+ **TriCache** is a three-tier caching engine for Node.js: **L1 RAM** $\rightarrow$ **L1.5 disk or `/dev/shm` spill** $\rightarrow$ **L2 Redis/Valkey**. It combines bounded local storage, per-process singleflight, configurable stale-while-revalidate, and distributed invalidation. Performance and savings depend on your workload; [benchmark your deployment](BENCHMARKS.md).
16
16
 
17
17
  ---
18
18
 
@@ -27,16 +27,17 @@ import { CacheService } from 'tricache';
27
27
 
28
28
  // 1. One-line preset: W-TinyLFU, Redis Streams, /dev/shm off-heap spill, & SWR
29
29
  const cache = CacheService.preset('nextjs', { redisHost: process.env.REDIS_HOST });
30
+ await cache.ready();
30
31
 
31
32
  // 2. Get-or-fetch with thundering-herd coalescing & 60s background SWR
32
33
  const user = await cache.get(
33
34
  `user:${userId}`,
34
35
  () => db.users.findById(userId),
35
36
  300, // 5-minute TTL
36
- { swr: 60 } // Serve stale for 60s while refreshing in the background
37
+ { swr: 60, tags: ['users'] } // Serve stale for 60s while refreshing in the background
37
38
  );
38
39
 
39
- // 3. Invalidate group entries in O(1) time across your entire cluster
40
+ // 3. Bump a concrete tag generation and publish invalidation to peers
40
41
  await cache.invalidateTag('users');
41
42
  ```
42
43
 
@@ -49,26 +50,26 @@ await cache.invalidateTag('users');
49
50
  │
50
51
  ▼
51
52
  ┌──────────────────────────────────────────────────┐
52
- │ L1: Smart Memory (W-TinyLFU + CMS) │ ~350 ns (2.81M ops/s)
53
- │ Window LRU (1%) + Segmented Main SLRU (99%) │ Zero V8 allocation
53
+ │ L1: Smart Memory (W-TinyLFU + CMS) │ Bounded RAM
54
+ │ Window LRU (1%) + Segmented Main SLRU (99%) │ Packed values
54
55
  └────────────────────────┬─────────────────────────┘
55
56
  │ Miss / Eviction Spill
56
57
  ▼
57
58
  ┌──────────────────────────────────────────────────┐
58
- │ L1.5: Off-Heap /dev/shm & NVMe Spill Tier │ ~20 µs (RAM speed)
59
- │ POSIX tmpfs bypasses V8 GC & cloud EBS IOPS │ readOnlyRootFilesystem
59
+ │ L1.5: Off-Heap /dev/shm & NVMe Spill Tier │ Bounded I/O
60
+ │ tmpfs counts toward container memory usage │ Writable mount needed
60
61
  └────────────────────────┬─────────────────────────┘
61
62
  │ Miss
62
63
  ▼
63
64
  ┌──────────────────────────────────────────────────┐
64
65
  │ L2: Redis / Valkey Distributed Tier │ ~1.2 ms (Network)
65
- │ AES-256-GCM AEAD at-rest + msgpackr records │ Pipelined MGET/MSET
66
+ │ Optional AES-GCM + expiry/tag metadata │ Pipelined commands
66
67
  └────────────────────────┬─────────────────────────┘
67
68
  │ Complete Cache Miss
68
69
  ▼
69
70
  ┌──────────────────────────────────────────────────┐
70
- │ Upstream Database / API (Singleflight Lock) │ Exactly 1 execution
71
- │ Inflight Promise Map coalesces 10,000 callers │ Zero stampedes
71
+ │ Upstream Database / API (Singleflight) │ Per process/key
72
+ │ Inflight Promise Map coalesces concurrent work│ Not a fleet-wide lock
72
73
  └──────────────────────────────────────────────────┘
73
74
  ```
74
75
 
@@ -77,32 +78,31 @@ await cache.invalidateTag('users');
77
78
  * **Off-Heap `/dev/shm` RAM Spill**: Targets Linux POSIX shared memory tmpfs ($\ge 256\text{MB}$ total, $\ge 128\text{MB}$ free), burning 0 cloud IOPS. [[SRE Guide $\rightarrow$](https://kareem411.github.io/TriCache/kubernetes-production-guide)]
78
79
  * **Dynamic Latency Watchdog**: Graduated shedding (0% $\rightarrow$ 25% $\rightarrow$ 75% $\rightarrow$ 100%) with asymmetric Redis hysteresis (15ms cutoff, 10ms recovery floor).
79
80
  * **Ephemeral Quotas & K8s Eviction Defense**: Chunked watermark pruning (80% $\rightarrow$ 60% in 500-entry batches) and proactive $<10\%$ space spill pauses.
80
- * **Wildcard & Hierarchical Tag Invalidation**: Glob matching (`user:*`) and parent-child tree cascading (`{ cascade: true }`) over $O(1)$ generational version counters.
81
+ * **Wildcard & Hierarchical Tag Invalidation**: Concrete generation bumps are $O(1)$; wildcard and hierarchy resolution scan matching tag metadata.
81
82
  * **Differential Multi-Tier Waterfall Batching**: Cascading `cache.mget` resolves L1 $\rightarrow$ L2 $\rightarrow$ Disk $\rightarrow$ DB miss fetch with zero $N+1$ queries.
82
83
  * **Zero-Dependency Cloud Hydration (SigV4)**: Hydrates cold pods from S3/R2 in milliseconds via native Web Crypto. [[Cloud Guide $\rightarrow$](https://kareem411.github.io/TriCache/cold-start-cloud-hydration)]
83
84
 
84
85
  ---
85
86
 
86
- ## 🏆 Feature Comparison
87
+ ## 🏆 Feature Overview
87
88
 
88
- | Dimension | `lru-cache` | `keyv` / `cache-manager` | `@neshca/cache-handler` | **TriCache** |
89
- |:---|:---|:---|:---|:---|
90
- | **Storage Hierarchy** | In-Memory only | Single Remote (Redis) | Memory + Redis | **Three-Tier (RAM $\rightarrow$ `/dev/shm` $\rightarrow$ Redis)** |
91
- | **Warm Hit Latency** | ~300 ns | 1,200,000 ns (1.2 ms) | ~400 ns | **356 ns (2.81M ops/sec)** |
92
- | **Thundering-Herd Defense**| ❌ No | ❌ External plugin | ❌ No | **✅ Native Singleflight Coalescing** |
93
- | **Tag Invalidation** | ❌ None | $O(N)$ blocking scan | $O(N)$ Redis Set | **✅ $O(1)$ Generational + Wildcards & Cascades** |
94
- | **Cluster Sync Backplane**| ❌ None | At-most-once Pub/Sub | Pub/Sub | **✅ Durable Redis Streams (`XADD`/`XREAD`)** |
95
- | **Compression** | ❌ None | ❌ Manual | ❌ None | **✅ WebAssembly Zstandard (Default) & LZ4** |
96
- | **Waterfall Batching (`mget`)**| ❌ None | ❌ Manual loops | ❌ None | **✅ Multi-Tier Cascading ($0$ $N+1$ Queries)** |
97
- | **Container Memory Safety**| Unbounded GC | N/A (Remote only) | Heap-bound | **✅ Off-heap tmpfs + 80% OOM Guard** |
98
- | **Encryption at Rest** | ❌ None | ❌ None | ❌ None | **✅ AES-256-GCM / Web Crypto AEAD** |
89
+ | Feature | Behavior |
90
+ |:---|:---|
91
+ | **Storage hierarchy** | RAM → eligible disk/tmpfs spill → Redis/Valkey |
92
+ | **Singleflight** | Coalesces concurrent work per process and key |
93
+ | **Tag invalidation** | Concrete generation bumps; metadata scans for patterns/cascades |
94
+ | **Backplane** | Pub/Sub or retained-event Redis Streams replay |
95
+ | **Compression** | Zstandard with fallback; optional Brotli, gzip, LZ4, or custom compressor |
96
+ | **Batch reads** | Resolves cached keys and fetches only remaining misses |
97
+ | **Resource controls** | Packed-data limits, bounded disk I/O, and cgroup pressure guards |
98
+ | **Encryption** | Optional AES-GCM for Node and Web Crypto edge storage |
99
99
 
100
100
  ---
101
101
 
102
102
  ## 🎯 Production Presets (`CacheService.preset`)
103
103
 
104
104
  ```typescript
105
- // 1. Next.js 16 / 15 App Router (Optimized for React 19 RSC streams & generational tags)
105
+ // 1. Next.js 16 App Router (React 19 RSC streams & generational tags)
106
106
  const cache = CacheService.preset('nextjs', { redisHost: 'redis.internal' });
107
107
 
108
108
  // 2. High-Throughput Microservice (Streams backplane, TTL jitter, circuit breakers)
@@ -121,16 +121,24 @@ const cache = CacheService.preset('enterprise-hardened', { redisHost: 'redis.int
121
121
 
122
122
  | Integration | Import Path | Description |
123
123
  |:---|:---|:---|
124
- | **Next.js 16 & 15** | `tricache/next` | Drop-in `cacheHandler` with RSC stream re-hydration and dynamic `softTags`. |
125
- | **NestJS Module** | `tricache/nestjs` | Official `TriCacheModule.register()`, `@nestjs/cache-manager` store adapter, and `@Cacheable`. |
124
+ | **Next.js 16** | `tricache/next` | Native Cache Components `cacheHandlers` with bounded RSC streams, timing preservation, and soft-tag expiry. |
125
+ | **NestJS 10–12** | `tricache/nestjs` | `TriCacheModule`, millisecond TTL facade, Keyv 5/cache-manager 7 adapter, and `@Cacheable`. |
126
126
  | **Prisma ORM** | `tricache/prisma` | `$extends` client extension with query hashing and auto-mutation tag eviction. |
127
127
  | **Drizzle ORM** | `tricache/drizzle` | `withCache(query, opts)` query wrapper with SQL+parameters hashing and background SWR. |
128
128
  | **Express & Fastify** | `tricache/http` | Route caching middleware with deterministic query sorting, weak ETag, and `304 Not Modified`. |
129
- | **Node Hono** | `tricache/hono` | First-class `cacheMiddleware` on `CacheService` with ttl/tags/SWR and `304 Not Modified`. |
129
+ | **Node Hono** | `tricache/hono` | Response caching with TTL/tags, privacy guards, and `304 Not Modified`. |
130
130
  | **Edge Isolates & Hono** | `tricache/edge` | Zero-Node-dependency implementation for Cloudflare Workers, Fastly Compute, Hono, and Vercel Edge. |
131
131
  | **SSE Dashboard** | `tricache/dashboard` | Zero-dependency Server-Sent Events real-time admin dashboard. |
132
132
  | **Live CLI Top** | `npx tricache top` | Real-time terminal ASCII monitor over Unix sockets and Windows named pipes. |
133
133
 
134
+ ### Safety and consistency
135
+
136
+ - HTTP middleware bypasses credentialed requests by default and excludes private, cookie-setting, partial, and unkeyed `Vary` responses. Response refreshes run on live requests; use `cache.get()`/`wrap()` for data-level SWR.
137
+ - Dashboard access should be authenticated and private. It defaults to `readOnly: true`; administrative writes require explicit opt-in.
138
+ - Redis Streams provide replay only while events are retained. A detected gap flushes local state. `awaitInvalidationBackplane: true` confirms publication, not peer acknowledgments or exactly-once delivery.
139
+ - Redis promotions preserve remaining TTL where supported. Custom drivers without atomic expiry reads use fallback TTLs; edge legacy JSON without expiry metadata is read without local promotion.
140
+ - `/dev/shm` reduces disk I/O but still consumes container memory. Encryption and cache configuration do not by themselves establish regulatory compliance.
141
+
134
142
  ---
135
143
 
136
144
  ## 📚 Documentation & Deep Dives
@@ -1,4 +1,4 @@
1
- import { C as CacheOptions, b as CacheMetrics, c as CacheHealthStatus, d as CachePresetType, e as CrossRegionInvalidationEvent, f as CachePriority, W as WrapOptions, a as InvalidateTagOptions, g as CachePingResult, D as DiskBackpressureStats, L as LockOptions, E as EncryptionMode, h as WTinyLfuStats } from './types-Dyip5wAl.js';
1
+ import { C as CacheOptions, b as CacheMetrics, c as CacheHealthStatus, d as CachePresetType, e as CrossRegionInvalidationEvent, f as CachePriority, W as WrapOptions, a as InvalidateTagOptions, g as CachePingResult, D as DiskBackpressureStats, L as LockOptions, E as EncryptionMode, h as WTinyLfuStats } from './types-BA4pz1A0.js';
2
2
 
3
3
  /**
4
4
  * TierLatencyWatchdog — Graduated, self-healing tier latency watchdog.
@@ -141,6 +141,8 @@ declare class IpcTelemetryServer {
141
141
  private server;
142
142
  readonly socketPath: string;
143
143
  private _closed;
144
+ private _starting;
145
+ private readonly sockets;
144
146
  private _exitHandler;
145
147
  private _sigintHandler;
146
148
  private _sigtermHandler;
@@ -149,6 +151,7 @@ declare class IpcTelemetryServer {
149
151
  * Start listening on the IPC socket / pipe.
150
152
  */
151
153
  start(): Promise<void>;
154
+ private startInternal;
152
155
  /**
153
156
  * Build a complete telemetry snapshot from the underlying cache provider.
154
157
  */
@@ -241,6 +244,7 @@ declare class CacheService {
241
244
  private readonly keyTags;
242
245
  /** tag → { version, lastSyncedAt } for generational tag invalidation (bounded to 10,000 entries) */
243
246
  private readonly tagVersions;
247
+ private _tagRefreshEpoch;
244
248
  /**
245
249
  * Dependency index: source glob pattern → Set of namespaced dependent keys.
246
250
  * When an exact-key delete matches a registered pattern, all dependents are cascaded.
@@ -271,9 +275,17 @@ declare class CacheService {
271
275
  private subClient;
272
276
  private streamClient;
273
277
  private _lastStreamId;
278
+ private _restoredSnapshot;
279
+ private _backplaneAvailable;
280
+ private _otelCleanup;
281
+ private _streamRecovering;
282
+ private readonly _backplaneDisposers;
274
283
  private _destroyed;
275
284
  private readonly _pendingDiskDeletes;
276
285
  private _globalEpoch;
286
+ private _pendingSpillCount;
287
+ private _suppressSpills;
288
+ private _diskCleanupScheduled;
277
289
  private readonly _keyMutationEpochs;
278
290
  /**
279
291
  * Pattern tombstones for disk tier.
@@ -282,15 +294,26 @@ declare class CacheService {
282
294
  * pattern tombstones in memory to intercept subsequent disk reads and evict matching files.
283
295
  */
284
296
  private readonly _patternTombstones;
297
+ private _diskInvalidatedBefore;
285
298
  private _addPatternTombstone;
286
299
  private _isTombstonedByPattern;
287
300
  private _assertActive;
288
301
  private _bumpKeyMutation;
289
302
  private _getKeyMutationEpoch;
303
+ /** Capture a commit fence before asynchronous computation outside the cache. */
304
+ captureMutationFence(cacheKey: string): () => boolean;
305
+ /** Force tag re-sync without forgetting locally observed monotonic generations. */
306
+ refreshTagVersions(): void;
307
+ private _fenceInvalidation;
308
+ private _invalidateDiskKey;
309
+ private _scheduleDiskCleanup;
310
+ private _registerDependencies;
311
+ private _rememberTags;
312
+ private _restoreEntryMetadata;
290
313
  private _removeKeyTags;
291
314
  private _removeKeyDependencies;
292
315
  private _handleL1Eviction;
293
- private _removePrefixFromIndices;
316
+ private _removePatternFromIndices;
294
317
  private _sweepExpiredMetadata;
295
318
  private _runOomCheck;
296
319
  private _ipcServer?;
@@ -342,7 +365,7 @@ declare class CacheService {
342
365
  private static optionsDiff;
343
366
  /** Increment the singleton-divergence counter (surfaced in `metrics()`). */
344
367
  bumpSingletonDivergence(): void;
345
- /** Read-only view of the options the singleton was constructed with. */
368
+ /** Sanitized diagnostic view; retain the original options/adapters to reuse configuration. */
346
369
  get options(): CacheOptions;
347
370
  /**
348
371
  * Async factory — accepts a Promise that resolves to CacheOptions.
@@ -374,7 +397,9 @@ declare class CacheService {
374
397
  /** Start an OTEL-compatible span if a tracer is configured. Returns a no-op span otherwise. */
375
398
  private _startSpan;
376
399
  private createDedicatedRedisClient;
400
+ private _listenBackplane;
377
401
  private initBackplane;
402
+ private _resetAfterStreamGap;
378
403
  private _startStreamConsumer;
379
404
  /**
380
405
  * Validate + apply one XREAD stream entry. `fields` is the flat ioredis
@@ -406,6 +431,11 @@ declare class CacheService {
406
431
  private _parseGenerationalRedisHash;
407
432
  private _readRedisEntry;
408
433
  private _getTagVersion;
434
+ private _readRedisBatch;
435
+ private _promoteRedisEntry;
436
+ private _readDiskEntry;
437
+ /** Common write policy and metadata across get/set/revalidation/draining. */
438
+ private _writeRedisEntry;
409
439
  private _deleteIfStale;
410
440
  /**
411
441
  * Serialize payload for L2 Redis storage applying compression and encryption as configured.
@@ -482,6 +512,8 @@ declare class CacheService {
482
512
  * On an L1/L2 hit the tags are already registered — this field is a no-op for hits.
483
513
  */
484
514
  tags?: string[];
515
+ /** Dependency patterns registered when a miss populates the entry. */
516
+ dependsOn?: string[];
485
517
  }): Promise<T>;
486
518
  /**
487
519
  * Graceful shutdown flusher for Kubernetes preStop hooks, NestJS onApplicationShutdown,
@@ -621,7 +653,7 @@ declare class CacheService {
621
653
  */
622
654
  scan<T = unknown>(fn: (rawKey: string, value: T, offset: number) => void): void;
623
655
  /**
624
- * Extend the TTL of a key in L1 (and fire-and-forget EXPIRE in Redis) without fetching.
656
+ * Extend the TTL of a key in L1 and Redis without fetching.
625
657
  * Returns `false` if the key is absent or already expired.
626
658
  *
627
659
  * @param newTtlSeconds - The new TTL from now, in seconds.