tricache 1.0.2 → 2.0.0

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 (101) hide show
  1. package/README.md +78 -90
  2. package/dashboards/tricache-alerts.yaml +80 -4
  3. package/dashboards/tricache-grafana.json +54 -1
  4. package/dashboards/tricache-inventory.rules.yml +21 -0
  5. package/dist/{cache-service-CWI4jkS7.d.cts → cache-service-BV5T8-20.d.cts} +122 -21
  6. package/dist/cache-service-UZXOQGEY.js +14 -0
  7. package/dist/{cache-service-B108FzER.d.ts → cache-service-tpyrXvlH.d.ts} +122 -21
  8. package/dist/{chunk-UBWLPKTI.js → chunk-EJXG7WO6.js} +152 -32
  9. package/dist/{chunk-H4GFLQ26.js → chunk-KV7KISK2.js} +47 -1
  10. package/dist/{chunk-WYF7NOAT.js → chunk-MB3DMVWN.js} +2111 -543
  11. package/dist/{chunk-OYDU3SMI.js → chunk-RBJRTGFK.js} +5 -0
  12. package/dist/chunk-S5N65I45.js +17 -0
  13. package/dist/cli.cjs +2454 -572
  14. package/dist/cli.js +186 -11
  15. package/dist/dashboard/index.d.cts +2 -2
  16. package/dist/dashboard/index.d.ts +2 -2
  17. package/dist/drizzle/index.cjs +2335 -571
  18. package/dist/drizzle/index.d.cts +2 -2
  19. package/dist/drizzle/index.d.ts +2 -2
  20. package/dist/drizzle/index.js +6 -2
  21. package/dist/edge/index.cjs +145 -43
  22. package/dist/edge/index.d.cts +11 -4
  23. package/dist/edge/index.d.ts +11 -4
  24. package/dist/edge/index.js +118 -43
  25. package/dist/hono/index.cjs +2322 -569
  26. package/dist/hono/index.d.cts +2 -2
  27. package/dist/hono/index.d.ts +2 -2
  28. package/dist/hono/index.js +2 -2
  29. package/dist/{hono-C886ok3X.d.cts → hono-CMv2VdQ6.d.cts} +18 -5
  30. package/dist/{hono-3rDMYVtY.d.ts → hono-Dvq04kX9.d.ts} +18 -5
  31. package/dist/http/index.cjs +2323 -570
  32. package/dist/http/index.d.cts +3 -3
  33. package/dist/http/index.d.ts +3 -3
  34. package/dist/http/index.js +4 -4
  35. package/dist/index.cjs +2554 -620
  36. package/dist/index.d.cts +88 -23
  37. package/dist/index.d.ts +88 -23
  38. package/dist/index.js +873 -16
  39. package/dist/{murmur3-CMGw9PbV.d.cts → murmur3-DF8BFRnu.d.cts} +1 -0
  40. package/dist/{murmur3-CMGw9PbV.d.ts → murmur3-DF8BFRnu.d.ts} +1 -0
  41. package/dist/nestjs/index.cjs +2292 -574
  42. package/dist/nestjs/index.d.cts +19 -5
  43. package/dist/nestjs/index.d.ts +19 -5
  44. package/dist/nestjs/index.js +25 -19
  45. package/dist/next/index.cjs +2306 -571
  46. package/dist/next/index.d.cts +8 -2
  47. package/dist/next/index.d.ts +8 -2
  48. package/dist/next/index.js +36 -9
  49. package/dist/prisma/index.cjs +26 -25
  50. package/dist/prisma/index.d.cts +2 -2
  51. package/dist/prisma/index.d.ts +2 -2
  52. package/dist/prisma/index.js +14 -25
  53. package/dist/serialize-worker.cjs +162 -39
  54. package/dist/serialize-worker.js +9 -7
  55. package/dist/{types-BA4pz1A0.d.cts → types-F8vRWMrE.d.cts} +162 -45
  56. package/dist/{types-BA4pz1A0.d.ts → types-F8vRWMrE.d.ts} +162 -45
  57. package/package.json +21 -2
  58. package/src/adapters/auto-pipeliner.ts +52 -11
  59. package/src/cache-service.ts +1537 -415
  60. package/src/cli.ts +2 -9
  61. package/src/codec.ts +3 -3
  62. package/src/compression.ts +39 -16
  63. package/src/cross-region.ts +1 -1
  64. package/src/disk-tier.ts +283 -43
  65. package/src/drizzle/index.ts +2 -1
  66. package/src/edge/adapters/cloudflare-do.ts +25 -10
  67. package/src/edge/adapters/cloudflare-kv.ts +12 -9
  68. package/src/edge/adapters/upstash.ts +27 -11
  69. package/src/edge/cache.ts +59 -17
  70. package/src/edge/types.ts +15 -5
  71. package/src/encryption.ts +50 -18
  72. package/src/env.d.ts +1 -1
  73. package/src/errors.ts +12 -0
  74. package/src/http/utils.ts +6 -0
  75. package/src/index.ts +6 -0
  76. package/src/latency-watchdog.ts +5 -1
  77. package/src/nestjs/decorators.ts +11 -6
  78. package/src/nestjs/tricache.module.ts +2 -1
  79. package/src/nestjs/tricache.store.ts +21 -9
  80. package/src/nestjs/types.ts +1 -1
  81. package/src/next/cache-handler.ts +24 -4
  82. package/src/next/types.ts +4 -0
  83. package/src/origin-capacity.ts +134 -0
  84. package/src/prisma/index.ts +14 -32
  85. package/src/remote-snapshot.ts +37 -27
  86. package/src/serialize-worker.ts +8 -5
  87. package/src/sigv4-snapshot-adapter.ts +37 -27
  88. package/src/smart-memory-cache.ts +62 -22
  89. package/src/types.ts +92 -35
  90. package/src/utils/config-comparison.ts +29 -0
  91. package/src/utils/lz4-size.ts +74 -0
  92. package/src/utils/namespace-key.ts +48 -0
  93. package/src/utils/query-key.ts +13 -0
  94. package/src/utils/snapshot-transfer.ts +83 -0
  95. package/src/utils/work-limits.ts +73 -0
  96. package/src/utils/write-revision.ts +4 -0
  97. package/src/wasm/bloom-filter-wasm.ts +16 -1
  98. package/src/worker-pool.ts +28 -8
  99. package/src/wtiny-lfu.ts +62 -14
  100. package/dist/cache-service-GYPZFB7O.js +0 -12
  101. package/dist/chunk-VNRDL5RA.js +0 -666
package/dist/index.d.cts CHANGED
@@ -1,7 +1,7 @@
1
- export { C as CacheService, I as IIpcCacheProvider, a as IpcMetricsPayload, b as IpcTelemetryClient, c as IpcTelemetryServer, L as LatencyWatchdogOptions, d as LatencyWatchdogTelemetry, P as ProcessTerminationBus, T as TierLatencyWatchdog, e as deepMergeOptions, f as findActiveSockets, g as formatBytes, h as formatDuration, i as formatNumber, r as renderProgressBar, j as renderTopDashboard, k as resolveIpcSocketPath } from './cache-service-CWI4jkS7.cjs';
2
- import { j as IRemoteSnapshotAdapter, k as CategoryLimit, S as SmartCacheEntry, l as EvictionReason, i as ILogger, m as CacheHit, f as CachePriority, h as WTinyLfuStats$1, n as CacheEncryption, o as CompressionAlgorithm, p as DiskCacheEntry, D as DiskBackpressureStats, q as IRedisDriver, r as IRedisPipeline } from './types-BA4pz1A0.cjs';
3
- export { c as CacheHealthStatus, b as CacheMetrics, C as CacheOptions, g as CachePingResult, d as CachePresetType, e as CrossRegionInvalidationEvent, s as CrossRegionRelayOptions, t as CustomCompressor, E as EncryptionMode, u as EnvelopeEncryption, v as EnvelopeEncryptionOptions, H as HttpMeshRelayOptions, w as HttpSnapshotAdapterOptions, x as ICacheBatchObservableCallback, y as ICacheCounter, z as ICacheMeter, A as ICacheObservableGauge, B as ICacheSpan, F as ICacheSpanLink, I as ICacheTracer, G as ICrossRegionRelay, a as InvalidateTagOptions, L as LockOptions, R as RemoteSnapshotOptions, J as WebhookRequestLike, K as WebhookResponseLike, W as WrapOptions, M as consoleLogger, N as createCrossRegionWebhookHandler, O as createCustomCrossRegionRelay, P as createCustomSnapshotAdapter, Q as createHttpMeshRelay, T as createHttpSnapshotAdapter, U as createMemoryCrossRegionRelay, V as createMemorySnapshotAdapter, X as initZstd } from './types-BA4pz1A0.cjs';
4
- export { B as BloomFilterStats, M as Murmur3BloomFilter, W as WasmBloomFilter, m as murmur3_32 } from './murmur3-CMGw9PbV.cjs';
1
+ export { C as CacheService, I as IIpcCacheProvider, a as IpcMetricsPayload, b as IpcTelemetryClient, c as IpcTelemetryServer, L as LatencyWatchdogOptions, d as LatencyWatchdogTelemetry, P as ProcessTerminationBus, T as TierLatencyWatchdog, e as deepMergeOptions, f as findActiveSockets, g as formatBytes, h as formatDuration, i as formatNumber, r as renderProgressBar, j as renderTopDashboard, k as resolveIpcSocketPath } from './cache-service-BV5T8-20.cjs';
2
+ import { j as IRemoteSnapshotAdapter, S as SnapshotTransferOptions, k as SnapshotRequestOptions, l as CategoryLimit, m as SmartCacheEntry, n as EvictionReason, i as ILogger, o as CacheHit, f as CachePriority, h as WTinyLfuStats$1, p as CacheEncryption, q as CompressionAlgorithm, r as DiskCacheEntry, D as DiskBackpressureStats, s as IRedisDriver, t as IRedisPipeline } from './types-F8vRWMrE.cjs';
3
+ export { c as CacheHealthStatus, b as CacheMetrics, C as CacheOptions, g as CachePingResult, d as CachePresetType, e as CrossRegionInvalidationEvent, u as CrossRegionRelayOptions, v as CustomCompressor, E as EncryptionMode, w as EnvelopeEncryption, x as EnvelopeEncryptionOptions, H as HttpMeshRelayOptions, y as HttpSnapshotAdapterOptions, z as ICacheBatchObservableCallback, A as ICacheCounter, B as ICacheMeter, F as ICacheObservableGauge, G as ICacheSpan, J as ICacheSpanLink, I as ICacheTracer, K as ICrossRegionRelay, a as InvalidateTagOptions, L as LockOptions, O as OriginCapacityLimiter, M as OriginCapacityMetrics, N as OriginCapacityOptions, P as OriginRunOptions, R as RemoteSnapshotOptions, Q as WebhookRequestLike, T as WebhookResponseLike, W as WrapOptions, U as consoleLogger, V as createCrossRegionWebhookHandler, X as createCustomCrossRegionRelay, Y as createCustomSnapshotAdapter, Z as createHttpMeshRelay, _ as createHttpSnapshotAdapter, $ as createMemoryCrossRegionRelay, a0 as createMemorySnapshotAdapter, a1 as initZstd } from './types-F8vRWMrE.cjs';
4
+ export { B as BloomFilterStats, M as Murmur3BloomFilter, W as WasmBloomFilter, m as murmur3_32 } from './murmur3-DF8BFRnu.cjs';
5
5
  import { EventEmitter } from 'node:events';
6
6
  export { DashboardActionEvent, DashboardOptions, DashboardPeerInstance, StandaloneDashboardOptions, createNextDashboardHandlers, handleDashboardRequest, startDashboardServer, tricacheDashboard } from './dashboard/index.cjs';
7
7
  import 'crypto';
@@ -18,7 +18,7 @@ import 'node:http';
18
18
  * or custom S3-compatible object storage WITHOUT pulling in the 30MB @aws-sdk/client-s3.
19
19
  */
20
20
 
21
- interface SigV4SnapshotAdapterOptions {
21
+ interface SigV4SnapshotAdapterOptions extends SnapshotTransferOptions {
22
22
  /** S3 or Cloudflare R2 bucket name */
23
23
  bucket: string;
24
24
  /** Object key / filename for the snapshot (e.g. 'production-l1.snap') */
@@ -48,11 +48,12 @@ declare class SigV4SnapshotAdapter implements IRemoteSnapshotAdapter {
48
48
  private readonly sessionToken?;
49
49
  private readonly forcePathStyle;
50
50
  private readonly fetchImpl;
51
+ private readonly transfer;
51
52
  constructor(options: SigV4SnapshotAdapterOptions);
52
53
  private _resolveTarget;
53
54
  private _buildHeaders;
54
- get(): Promise<Buffer | null>;
55
- put(data: Buffer): Promise<void>;
55
+ get(request?: SnapshotRequestOptions): Promise<Buffer | null>;
56
+ put(data: Buffer, request?: SnapshotRequestOptions): Promise<void>;
56
57
  }
57
58
  /**
58
59
  * Creates a zero-dependency AWS SigV4 snapshot adapter for AWS S3, Cloudflare R2, MinIO, or custom gateways.
@@ -92,13 +93,13 @@ interface CacheCodecOptions {
92
93
  moreTypes?: boolean;
93
94
  /**
94
95
  * Decode MessagePack maps as plain JavaScript objects.
95
- * Default: true (ensures plain JS objects and standard maps decode to plain objects).
96
+ * Default: false (preserves Map; record-encoded plain objects remain objects).
96
97
  */
97
98
  mapsAsObjects?: boolean;
98
99
  }
99
100
  /**
100
101
  * CacheCodec wraps msgpackr's Packr/Unpackr to provide unified, high-performance binary
101
- * serialization across L1 in-memory buffers, L1.5 disk spill, and cold-start snapshots.
102
+ * serialization across L1 in-memory buffers, L1.5 disk spill, Redis, and cold-start snapshots.
102
103
  */
103
104
  declare class CacheCodec {
104
105
  private readonly packr;
@@ -135,6 +136,8 @@ interface SmartMemoryCacheOptions {
135
136
  maxBytes: number;
136
137
  maxEntries: number;
137
138
  categories: Record<string, CategoryLimit>;
139
+ /** Storage-key prefix to skip when matching logical category prefixes. */
140
+ keyPrefixLength?: number;
138
141
  diskSpill?: (key: string, entry: SmartCacheEntry) => void | Promise<void>;
139
142
  onEviction?: (key: string, reason: EvictionReason) => void;
140
143
  logger: ILogger;
@@ -167,6 +170,7 @@ declare class SmartMemoryCache {
167
170
  private categoryKeys;
168
171
  private bloomChecks;
169
172
  private bloomFalsePos;
173
+ private bloomAbsentChecks;
170
174
  private compressions;
171
175
  private categoryHits;
172
176
  /** Counts every _delete() call — used to trigger bloom rebuild from ALL deletion paths. */
@@ -203,7 +207,15 @@ declare class SmartMemoryCache {
203
207
  private maybeRebuildBloom;
204
208
  private smartEvict;
205
209
  get(key: string): CacheHit | null;
206
- set(key: string, data: unknown, ttlMs: number, priority?: CachePriority, staleAt?: number, delta?: number, tagVersions?: Record<string, number>, setAt?: number, tags?: string[], dependsOn?: string[]): boolean;
210
+ /** Shared policy accounting for scalar and batch reads. */
211
+ recordAccess(key: string, entry: SmartCacheEntry, now?: number): void;
212
+ set(key: string, data: unknown, ttlMs: number, priority?: CachePriority, staleAt?: number, delta?: number, tagVersions?: Record<string, number>, setAt?: number, tags?: string[], dependsOn?: string[], revision?: string): boolean;
213
+ /**
214
+ * Store a value when its codec representation is already available.
215
+ * CacheService uses this to share one MessagePack encoding between L1 and
216
+ * Redis/disk writes on an origin fill. The buffer is treated as immutable.
217
+ */
218
+ setPacked(key: string, packed: Buffer, data: unknown, ttlMs: number, priority?: CachePriority, staleAt?: number, delta?: number, tagVersions?: Record<string, number>, setAt?: number, tags?: string[], dependsOn?: string[], revision?: string): boolean;
207
219
  private storePacked;
208
220
  delete(key: string): boolean;
209
221
  private keysMatchingPattern;
@@ -231,7 +243,7 @@ declare class SmartMemoryCache {
231
243
  evictPercentage(pct: number): number;
232
244
  cleanup(): number;
233
245
  /**
234
- * Evict all non-CRITICAL L1 entries that were written before `cutoffMs`.
246
+ * Evict all L1 entries that were written before `cutoffMs`, at every priority.
235
247
  *
236
248
  * Called by the backplane staleness fence when the Pub/Sub subscriber
237
249
  * reconnects after a disconnect gap that exceeded `backplaneMaxStalenessMs`.
@@ -250,10 +262,11 @@ declare class SmartMemoryCache {
250
262
  evictSetBefore(cutoffMs: number): number;
251
263
  /**
252
264
  * Delete a key only if its write timestamp (`setAt`) is <= `cutoffMs`.
253
- * Used for concurrency-safe compare-and-delete on stale generational reads,
254
- * guaranteeing that a newer value written by a concurrent revalidation is never wiped out.
265
+ * This is a time-based eviction policy; use deleteIfRevision for write identity.
255
266
  */
256
267
  deleteIfSetBefore(key: string, cutoffMs: number): boolean;
268
+ /** Remove exactly the observed write, even when another write shares its timestamp. */
269
+ deleteIfRevision(key: string, revision: string): boolean;
257
270
  exportEntries(forbiddenPrefixes: readonly string[]): Array<{
258
271
  key: string;
259
272
  entry: SmartCacheEntry;
@@ -316,6 +329,7 @@ declare class SmartMemoryCache {
316
329
  bloom: {
317
330
  checks: number;
318
331
  falsePositives: number;
332
+ absentChecks: number;
319
333
  };
320
334
  compression: {
321
335
  compressed: number;
@@ -342,7 +356,7 @@ declare class SmartMemoryCache {
342
356
  * Add additional milliseconds to a key's existing expiry (for stale-if-error).
343
357
  * Returns `false` if the key is absent or already expired.
344
358
  */
345
- bumpExpiry(key: string, additionalMs: number): boolean;
359
+ bumpExpiry(key: string, additionalMs: number, maximumExpiry?: number): boolean;
346
360
  bloomMightContain(key: string): boolean;
347
361
  bloomStats(): {
348
362
  bitsSet: number;
@@ -594,11 +608,16 @@ declare class BoundedDiskQueue {
594
608
  private consecutiveFailures;
595
609
  private circuitState;
596
610
  private lastStateChangeMonotonic;
611
+ private readonly idleWaiters;
597
612
  constructor(maxConcurrent?: number, maxPending?: number, writeTimeoutMs?: number, failureThreshold?: number, cooldownMs?: number);
598
613
  get isSaturated(): boolean;
599
614
  private releaseSlot;
615
+ /** Wait for physical work, not caller promises that may already have timed out. */
616
+ drain(timeoutMs?: number): Promise<boolean>;
600
617
  schedule<T>(task: () => Promise<T>): Promise<T | null>;
601
618
  getStats(): DiskBackpressureStats;
619
+ /** Resolve when every admitted physical task, including timed-out callers, settles. */
620
+ whenIdle(): Promise<void>;
602
621
  reset(): void;
603
622
  }
604
623
  /**
@@ -649,6 +668,9 @@ declare class DiskTier {
649
668
  private readonly pendingSaves;
650
669
  private closed;
651
670
  private readonly invalidatedKeys;
671
+ /** Hash buckets are bounded to 256; successful creation can be reused between spills. */
672
+ private readonly readyBuckets;
673
+ private readonly pendingBuckets;
652
674
  /** Next bucket index (0–255) for the staggered janitor wheel. */
653
675
  private _nextJanitorBucket;
654
676
  private _isPruning;
@@ -668,6 +690,7 @@ declare class DiskTier {
668
690
  private _stmtPruneChunk;
669
691
  constructor(opts: DiskTierOptions);
670
692
  private ensureDir;
693
+ private ensureBucket;
671
694
  /**
672
695
  * Initialise the SQLite metadata index. Called once after the cache directory
673
696
  * is confirmed to exist. On any failure the instance silently falls back to
@@ -699,6 +722,8 @@ declare class DiskTier {
699
722
  * 12 hex digits ≈ 6 bytes ≈ year 10889 max. Padded so length is always 77 chars.
700
723
  */
701
724
  private hashToWritePath;
725
+ /** Fixed, path-safe suffix lets cleanup select a revision without decoding its payload. */
726
+ private revisionSuffix;
702
727
  private findFilePaths;
703
728
  private fileWrittenAt;
704
729
  /**
@@ -734,22 +759,46 @@ declare class DiskTier {
734
759
  /**
735
760
  * Spill an evicted L1 entry to disk.
736
761
  *
737
- * Returns a Promise that resolves when the file is durably written. Callers
762
+ * Returns after the queue caller completes or times out; this is not an fsync
763
+ * durability guarantee. drain() separately waits for physical work. Callers
738
764
  * that treat the spill as fire-and-forget should do:
739
765
  * `void disk.save(key, entry)`
740
766
  *
741
767
  * Implementation notes:
742
- * - pack() + AES-256-GCM encrypt run synchronously — both are pure CPU,
743
- * sub-millisecond for entries up to diskEntryMaxBytes, and do not block
744
- * on any external resource.
745
- * - The actual write syscall (mkdir + writeFile) is async via fs.promises,
746
- * so the Node.js event loop is never stalled waiting for disk I/O.
768
+ * - Serialization/compression/encryption run synchronously; CPU cost depends
769
+ * on payload shape and size. Index and version-cleanup work can also block.
770
+ * - Staging writes and rename use fs.promises. Bucket creation is coalesced,
771
+ * and failed staging cleanup has one owner in the physical task's finally.
747
772
  */
748
773
  save(key: string, entry: DiskCacheEntry): Promise<void>;
749
774
  /** Load a key from disk, or return null on miss/expiry/corruption. */
750
775
  load(key: string): DiskCacheEntry | null;
776
+ /**
777
+ * Async variant of load() for the SQLite-indexed path.
778
+ *
779
+ * Disk hits sit directly on the request path in front of Redis. The sync
780
+ * load() above blocks the event loop for readdir/stat/read/unlink; under
781
+ * concurrent pressure those small stalls add up to tail latency. This
782
+ * variant keeps the same consume-on-read and validation semantics but uses
783
+ * fs.promises, and only removes the indexed file instead of scanning the
784
+ * whole bucket. Superseded files remain unreachable through the index and
785
+ * are removed by the existing expiry janitor.
786
+ *
787
+ * File-only mode (no node:sqlite) falls back to the synchronous path.
788
+ */
789
+ loadAsync(key: string): Promise<DiskCacheEntry | null>;
790
+ /**
791
+ * Delete the index row for `hash` only if it still points at `filePath`.
792
+ * The check and delete are synchronous, so a newer spill cannot slip between
793
+ * them. Returns true when this caller removed the row.
794
+ */
795
+ private deleteIndexRowIfCurrent;
796
+ /** Decode and validate a raw disk payload. Callers own file cleanup. */
797
+ private decodeLoadedPayload;
751
798
  /** Synchronously fence queued/running saves while leaving filesystem cleanup deferred. */
752
799
  invalidate(key: string): void;
800
+ /** Cancel and remove only the observed write; newer pending or stored spills survive. */
801
+ deleteIfRevision(key: string, revision: string): void;
753
802
  /** Delete all versions; deferred cleanup must not cancel a newer save. */
754
803
  delete(key: string, invalidatedOnly?: boolean): void;
755
804
  /** Purge all expired entries. Returns number deleted. */
@@ -809,6 +858,10 @@ declare class DiskTier {
809
858
  };
810
859
  /** Direct access to the bounded write queue for chaos diagnostics and canary controls. */
811
860
  get backpressure(): BoundedDiskQueue;
861
+ /** Wait for admitted physical spill tasks, including work past its caller timeout. */
862
+ drain(timeoutMs?: number): Promise<boolean>;
863
+ /** Wait unboundedly for physical writes and their reservation cleanup before closing the index. */
864
+ whenIdle(): Promise<void>;
812
865
  /** Whether a SQLite metadata index is active ('sqlite') or the disk is scanned directly ('file-only'). */
813
866
  get indexMode(): 'sqlite' | 'file-only';
814
867
  /** Release the SQLite connection (if open). Call during shutdown before deleting the cache directory. */
@@ -891,8 +944,8 @@ interface TimedRedisValue {
891
944
  * Automatically combines individual Redis commands dispatched during the same synchronous
892
945
  * tick of the Node.js event loop into a single `pipeline()` network round-trip.
893
946
  *
894
- * Uses `queueMicrotask` exclusively (never `setImmediate` or timers) to ensure ZERO
895
- * artificial latency penalty (0ms overhead) while slashing network syscalls under high concurrency.
947
+ * Uses `queueMicrotask` rather than a batching timer. Scheduling and command
948
+ * execution still have a cost; timed reads remain atomic within each batch.
896
949
  */
897
950
  declare class AutoPipeliner {
898
951
  private readonly client;
@@ -1003,4 +1056,16 @@ declare function isChildTag(parentTag: string, candidateTag: string, delimiter?:
1003
1056
  */
1004
1057
  declare function expandHierarchicalTags(tags: string[], delimiter?: string): string[];
1005
1058
 
1006
- export { AutoPipeliner, type AutoPipelinerOptions, type AutonomousL1Options, CacheCodec, type CacheCodecOptions, CacheEncryption, CacheHit, CachePriority, CategoryLimit, CompressionAlgorithm, DEFAULT_AUTONOMOUS_L1_CEILING_BYTES, DiskCacheEntry, DiskTier, EvictionReason, type EvictionResult, ILogger, IRedisDriver, IRedisPipeline, IRemoteSnapshotAdapter, MIN_AUTONOMOUS_L1_FLOOR_BYTES, NodeRedisAdapter, type ParsedTraceParent, SigV4SnapshotAdapter, type SigV4SnapshotAdapterOptions, SmartCacheEntry, SmartMemoryCache, TinyLfuSketch, WTinyLfuCache, type WTinyLfuOptions, WTinyLfuPolicy, type WTinyLfuStats, createNodeRedisAdapter, createR2SnapshotAdapter, createS3SnapshotAdapter, createSigV4SnapshotAdapter, defaultCodec, expandHierarchicalTags, formatTraceParent, getV8HeapLimit, isChildTag, isWildcardTag, matchesTagPattern, parseTraceParent, readCgroupMemoryLimit, resolveAutonomousL1MaxBytes, resolveDefaultDiskDir };
1059
+ /** Fail before allocating queues or starting user work. No implicit retry. */
1060
+ declare class CacheCapacityError extends Error {
1061
+ constructor(resource: string);
1062
+ }
1063
+
1064
+ /** Thrown when the opt-in read gate lacks fresh invalidation consumer proof. */
1065
+ declare class CacheInvalidationUnavailableError extends Error {
1066
+ readonly reason: string;
1067
+ readonly detectedAt: number | null;
1068
+ constructor(reason: string, detectedAt: number | null);
1069
+ }
1070
+
1071
+ export { AutoPipeliner, type AutoPipelinerOptions, type AutonomousL1Options, CacheCapacityError, CacheCodec, type CacheCodecOptions, CacheEncryption, CacheHit, CacheInvalidationUnavailableError, CachePriority, CategoryLimit, CompressionAlgorithm, DEFAULT_AUTONOMOUS_L1_CEILING_BYTES, DiskCacheEntry, DiskTier, EvictionReason, type EvictionResult, ILogger, IRedisDriver, IRedisPipeline, IRemoteSnapshotAdapter, MIN_AUTONOMOUS_L1_FLOOR_BYTES, NodeRedisAdapter, type ParsedTraceParent, SigV4SnapshotAdapter, type SigV4SnapshotAdapterOptions, SmartCacheEntry, SmartMemoryCache, SnapshotRequestOptions, SnapshotTransferOptions, TinyLfuSketch, WTinyLfuCache, type WTinyLfuOptions, WTinyLfuPolicy, type WTinyLfuStats, createNodeRedisAdapter, createR2SnapshotAdapter, createS3SnapshotAdapter, createSigV4SnapshotAdapter, defaultCodec, expandHierarchicalTags, formatTraceParent, getV8HeapLimit, isChildTag, isWildcardTag, matchesTagPattern, parseTraceParent, readCgroupMemoryLimit, resolveAutonomousL1MaxBytes, resolveDefaultDiskDir };
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
- export { C as CacheService, I as IIpcCacheProvider, a as IpcMetricsPayload, b as IpcTelemetryClient, c as IpcTelemetryServer, L as LatencyWatchdogOptions, d as LatencyWatchdogTelemetry, P as ProcessTerminationBus, T as TierLatencyWatchdog, e as deepMergeOptions, f as findActiveSockets, g as formatBytes, h as formatDuration, i as formatNumber, r as renderProgressBar, j as renderTopDashboard, k as resolveIpcSocketPath } from './cache-service-B108FzER.js';
2
- import { j as IRemoteSnapshotAdapter, k as CategoryLimit, S as SmartCacheEntry, l as EvictionReason, i as ILogger, m as CacheHit, f as CachePriority, h as WTinyLfuStats$1, n as CacheEncryption, o as CompressionAlgorithm, p as DiskCacheEntry, D as DiskBackpressureStats, q as IRedisDriver, r as IRedisPipeline } from './types-BA4pz1A0.js';
3
- export { c as CacheHealthStatus, b as CacheMetrics, C as CacheOptions, g as CachePingResult, d as CachePresetType, e as CrossRegionInvalidationEvent, s as CrossRegionRelayOptions, t as CustomCompressor, E as EncryptionMode, u as EnvelopeEncryption, v as EnvelopeEncryptionOptions, H as HttpMeshRelayOptions, w as HttpSnapshotAdapterOptions, x as ICacheBatchObservableCallback, y as ICacheCounter, z as ICacheMeter, A as ICacheObservableGauge, B as ICacheSpan, F as ICacheSpanLink, I as ICacheTracer, G as ICrossRegionRelay, a as InvalidateTagOptions, L as LockOptions, R as RemoteSnapshotOptions, J as WebhookRequestLike, K as WebhookResponseLike, W as WrapOptions, M as consoleLogger, N as createCrossRegionWebhookHandler, O as createCustomCrossRegionRelay, P as createCustomSnapshotAdapter, Q as createHttpMeshRelay, T as createHttpSnapshotAdapter, U as createMemoryCrossRegionRelay, V as createMemorySnapshotAdapter, X as initZstd } from './types-BA4pz1A0.js';
4
- export { B as BloomFilterStats, M as Murmur3BloomFilter, W as WasmBloomFilter, m as murmur3_32 } from './murmur3-CMGw9PbV.js';
1
+ export { C as CacheService, I as IIpcCacheProvider, a as IpcMetricsPayload, b as IpcTelemetryClient, c as IpcTelemetryServer, L as LatencyWatchdogOptions, d as LatencyWatchdogTelemetry, P as ProcessTerminationBus, T as TierLatencyWatchdog, e as deepMergeOptions, f as findActiveSockets, g as formatBytes, h as formatDuration, i as formatNumber, r as renderProgressBar, j as renderTopDashboard, k as resolveIpcSocketPath } from './cache-service-tpyrXvlH.js';
2
+ import { j as IRemoteSnapshotAdapter, S as SnapshotTransferOptions, k as SnapshotRequestOptions, l as CategoryLimit, m as SmartCacheEntry, n as EvictionReason, i as ILogger, o as CacheHit, f as CachePriority, h as WTinyLfuStats$1, p as CacheEncryption, q as CompressionAlgorithm, r as DiskCacheEntry, D as DiskBackpressureStats, s as IRedisDriver, t as IRedisPipeline } from './types-F8vRWMrE.js';
3
+ export { c as CacheHealthStatus, b as CacheMetrics, C as CacheOptions, g as CachePingResult, d as CachePresetType, e as CrossRegionInvalidationEvent, u as CrossRegionRelayOptions, v as CustomCompressor, E as EncryptionMode, w as EnvelopeEncryption, x as EnvelopeEncryptionOptions, H as HttpMeshRelayOptions, y as HttpSnapshotAdapterOptions, z as ICacheBatchObservableCallback, A as ICacheCounter, B as ICacheMeter, F as ICacheObservableGauge, G as ICacheSpan, J as ICacheSpanLink, I as ICacheTracer, K as ICrossRegionRelay, a as InvalidateTagOptions, L as LockOptions, O as OriginCapacityLimiter, M as OriginCapacityMetrics, N as OriginCapacityOptions, P as OriginRunOptions, R as RemoteSnapshotOptions, Q as WebhookRequestLike, T as WebhookResponseLike, W as WrapOptions, U as consoleLogger, V as createCrossRegionWebhookHandler, X as createCustomCrossRegionRelay, Y as createCustomSnapshotAdapter, Z as createHttpMeshRelay, _ as createHttpSnapshotAdapter, $ as createMemoryCrossRegionRelay, a0 as createMemorySnapshotAdapter, a1 as initZstd } from './types-F8vRWMrE.js';
4
+ export { B as BloomFilterStats, M as Murmur3BloomFilter, W as WasmBloomFilter, m as murmur3_32 } from './murmur3-DF8BFRnu.js';
5
5
  import { EventEmitter } from 'node:events';
6
6
  export { DashboardActionEvent, DashboardOptions, DashboardPeerInstance, StandaloneDashboardOptions, createNextDashboardHandlers, handleDashboardRequest, startDashboardServer, tricacheDashboard } from './dashboard/index.js';
7
7
  import 'crypto';
@@ -18,7 +18,7 @@ import 'node:http';
18
18
  * or custom S3-compatible object storage WITHOUT pulling in the 30MB @aws-sdk/client-s3.
19
19
  */
20
20
 
21
- interface SigV4SnapshotAdapterOptions {
21
+ interface SigV4SnapshotAdapterOptions extends SnapshotTransferOptions {
22
22
  /** S3 or Cloudflare R2 bucket name */
23
23
  bucket: string;
24
24
  /** Object key / filename for the snapshot (e.g. 'production-l1.snap') */
@@ -48,11 +48,12 @@ declare class SigV4SnapshotAdapter implements IRemoteSnapshotAdapter {
48
48
  private readonly sessionToken?;
49
49
  private readonly forcePathStyle;
50
50
  private readonly fetchImpl;
51
+ private readonly transfer;
51
52
  constructor(options: SigV4SnapshotAdapterOptions);
52
53
  private _resolveTarget;
53
54
  private _buildHeaders;
54
- get(): Promise<Buffer | null>;
55
- put(data: Buffer): Promise<void>;
55
+ get(request?: SnapshotRequestOptions): Promise<Buffer | null>;
56
+ put(data: Buffer, request?: SnapshotRequestOptions): Promise<void>;
56
57
  }
57
58
  /**
58
59
  * Creates a zero-dependency AWS SigV4 snapshot adapter for AWS S3, Cloudflare R2, MinIO, or custom gateways.
@@ -92,13 +93,13 @@ interface CacheCodecOptions {
92
93
  moreTypes?: boolean;
93
94
  /**
94
95
  * Decode MessagePack maps as plain JavaScript objects.
95
- * Default: true (ensures plain JS objects and standard maps decode to plain objects).
96
+ * Default: false (preserves Map; record-encoded plain objects remain objects).
96
97
  */
97
98
  mapsAsObjects?: boolean;
98
99
  }
99
100
  /**
100
101
  * CacheCodec wraps msgpackr's Packr/Unpackr to provide unified, high-performance binary
101
- * serialization across L1 in-memory buffers, L1.5 disk spill, and cold-start snapshots.
102
+ * serialization across L1 in-memory buffers, L1.5 disk spill, Redis, and cold-start snapshots.
102
103
  */
103
104
  declare class CacheCodec {
104
105
  private readonly packr;
@@ -135,6 +136,8 @@ interface SmartMemoryCacheOptions {
135
136
  maxBytes: number;
136
137
  maxEntries: number;
137
138
  categories: Record<string, CategoryLimit>;
139
+ /** Storage-key prefix to skip when matching logical category prefixes. */
140
+ keyPrefixLength?: number;
138
141
  diskSpill?: (key: string, entry: SmartCacheEntry) => void | Promise<void>;
139
142
  onEviction?: (key: string, reason: EvictionReason) => void;
140
143
  logger: ILogger;
@@ -167,6 +170,7 @@ declare class SmartMemoryCache {
167
170
  private categoryKeys;
168
171
  private bloomChecks;
169
172
  private bloomFalsePos;
173
+ private bloomAbsentChecks;
170
174
  private compressions;
171
175
  private categoryHits;
172
176
  /** Counts every _delete() call — used to trigger bloom rebuild from ALL deletion paths. */
@@ -203,7 +207,15 @@ declare class SmartMemoryCache {
203
207
  private maybeRebuildBloom;
204
208
  private smartEvict;
205
209
  get(key: string): CacheHit | null;
206
- set(key: string, data: unknown, ttlMs: number, priority?: CachePriority, staleAt?: number, delta?: number, tagVersions?: Record<string, number>, setAt?: number, tags?: string[], dependsOn?: string[]): boolean;
210
+ /** Shared policy accounting for scalar and batch reads. */
211
+ recordAccess(key: string, entry: SmartCacheEntry, now?: number): void;
212
+ set(key: string, data: unknown, ttlMs: number, priority?: CachePriority, staleAt?: number, delta?: number, tagVersions?: Record<string, number>, setAt?: number, tags?: string[], dependsOn?: string[], revision?: string): boolean;
213
+ /**
214
+ * Store a value when its codec representation is already available.
215
+ * CacheService uses this to share one MessagePack encoding between L1 and
216
+ * Redis/disk writes on an origin fill. The buffer is treated as immutable.
217
+ */
218
+ setPacked(key: string, packed: Buffer, data: unknown, ttlMs: number, priority?: CachePriority, staleAt?: number, delta?: number, tagVersions?: Record<string, number>, setAt?: number, tags?: string[], dependsOn?: string[], revision?: string): boolean;
207
219
  private storePacked;
208
220
  delete(key: string): boolean;
209
221
  private keysMatchingPattern;
@@ -231,7 +243,7 @@ declare class SmartMemoryCache {
231
243
  evictPercentage(pct: number): number;
232
244
  cleanup(): number;
233
245
  /**
234
- * Evict all non-CRITICAL L1 entries that were written before `cutoffMs`.
246
+ * Evict all L1 entries that were written before `cutoffMs`, at every priority.
235
247
  *
236
248
  * Called by the backplane staleness fence when the Pub/Sub subscriber
237
249
  * reconnects after a disconnect gap that exceeded `backplaneMaxStalenessMs`.
@@ -250,10 +262,11 @@ declare class SmartMemoryCache {
250
262
  evictSetBefore(cutoffMs: number): number;
251
263
  /**
252
264
  * Delete a key only if its write timestamp (`setAt`) is <= `cutoffMs`.
253
- * Used for concurrency-safe compare-and-delete on stale generational reads,
254
- * guaranteeing that a newer value written by a concurrent revalidation is never wiped out.
265
+ * This is a time-based eviction policy; use deleteIfRevision for write identity.
255
266
  */
256
267
  deleteIfSetBefore(key: string, cutoffMs: number): boolean;
268
+ /** Remove exactly the observed write, even when another write shares its timestamp. */
269
+ deleteIfRevision(key: string, revision: string): boolean;
257
270
  exportEntries(forbiddenPrefixes: readonly string[]): Array<{
258
271
  key: string;
259
272
  entry: SmartCacheEntry;
@@ -316,6 +329,7 @@ declare class SmartMemoryCache {
316
329
  bloom: {
317
330
  checks: number;
318
331
  falsePositives: number;
332
+ absentChecks: number;
319
333
  };
320
334
  compression: {
321
335
  compressed: number;
@@ -342,7 +356,7 @@ declare class SmartMemoryCache {
342
356
  * Add additional milliseconds to a key's existing expiry (for stale-if-error).
343
357
  * Returns `false` if the key is absent or already expired.
344
358
  */
345
- bumpExpiry(key: string, additionalMs: number): boolean;
359
+ bumpExpiry(key: string, additionalMs: number, maximumExpiry?: number): boolean;
346
360
  bloomMightContain(key: string): boolean;
347
361
  bloomStats(): {
348
362
  bitsSet: number;
@@ -594,11 +608,16 @@ declare class BoundedDiskQueue {
594
608
  private consecutiveFailures;
595
609
  private circuitState;
596
610
  private lastStateChangeMonotonic;
611
+ private readonly idleWaiters;
597
612
  constructor(maxConcurrent?: number, maxPending?: number, writeTimeoutMs?: number, failureThreshold?: number, cooldownMs?: number);
598
613
  get isSaturated(): boolean;
599
614
  private releaseSlot;
615
+ /** Wait for physical work, not caller promises that may already have timed out. */
616
+ drain(timeoutMs?: number): Promise<boolean>;
600
617
  schedule<T>(task: () => Promise<T>): Promise<T | null>;
601
618
  getStats(): DiskBackpressureStats;
619
+ /** Resolve when every admitted physical task, including timed-out callers, settles. */
620
+ whenIdle(): Promise<void>;
602
621
  reset(): void;
603
622
  }
604
623
  /**
@@ -649,6 +668,9 @@ declare class DiskTier {
649
668
  private readonly pendingSaves;
650
669
  private closed;
651
670
  private readonly invalidatedKeys;
671
+ /** Hash buckets are bounded to 256; successful creation can be reused between spills. */
672
+ private readonly readyBuckets;
673
+ private readonly pendingBuckets;
652
674
  /** Next bucket index (0–255) for the staggered janitor wheel. */
653
675
  private _nextJanitorBucket;
654
676
  private _isPruning;
@@ -668,6 +690,7 @@ declare class DiskTier {
668
690
  private _stmtPruneChunk;
669
691
  constructor(opts: DiskTierOptions);
670
692
  private ensureDir;
693
+ private ensureBucket;
671
694
  /**
672
695
  * Initialise the SQLite metadata index. Called once after the cache directory
673
696
  * is confirmed to exist. On any failure the instance silently falls back to
@@ -699,6 +722,8 @@ declare class DiskTier {
699
722
  * 12 hex digits ≈ 6 bytes ≈ year 10889 max. Padded so length is always 77 chars.
700
723
  */
701
724
  private hashToWritePath;
725
+ /** Fixed, path-safe suffix lets cleanup select a revision without decoding its payload. */
726
+ private revisionSuffix;
702
727
  private findFilePaths;
703
728
  private fileWrittenAt;
704
729
  /**
@@ -734,22 +759,46 @@ declare class DiskTier {
734
759
  /**
735
760
  * Spill an evicted L1 entry to disk.
736
761
  *
737
- * Returns a Promise that resolves when the file is durably written. Callers
762
+ * Returns after the queue caller completes or times out; this is not an fsync
763
+ * durability guarantee. drain() separately waits for physical work. Callers
738
764
  * that treat the spill as fire-and-forget should do:
739
765
  * `void disk.save(key, entry)`
740
766
  *
741
767
  * Implementation notes:
742
- * - pack() + AES-256-GCM encrypt run synchronously — both are pure CPU,
743
- * sub-millisecond for entries up to diskEntryMaxBytes, and do not block
744
- * on any external resource.
745
- * - The actual write syscall (mkdir + writeFile) is async via fs.promises,
746
- * so the Node.js event loop is never stalled waiting for disk I/O.
768
+ * - Serialization/compression/encryption run synchronously; CPU cost depends
769
+ * on payload shape and size. Index and version-cleanup work can also block.
770
+ * - Staging writes and rename use fs.promises. Bucket creation is coalesced,
771
+ * and failed staging cleanup has one owner in the physical task's finally.
747
772
  */
748
773
  save(key: string, entry: DiskCacheEntry): Promise<void>;
749
774
  /** Load a key from disk, or return null on miss/expiry/corruption. */
750
775
  load(key: string): DiskCacheEntry | null;
776
+ /**
777
+ * Async variant of load() for the SQLite-indexed path.
778
+ *
779
+ * Disk hits sit directly on the request path in front of Redis. The sync
780
+ * load() above blocks the event loop for readdir/stat/read/unlink; under
781
+ * concurrent pressure those small stalls add up to tail latency. This
782
+ * variant keeps the same consume-on-read and validation semantics but uses
783
+ * fs.promises, and only removes the indexed file instead of scanning the
784
+ * whole bucket. Superseded files remain unreachable through the index and
785
+ * are removed by the existing expiry janitor.
786
+ *
787
+ * File-only mode (no node:sqlite) falls back to the synchronous path.
788
+ */
789
+ loadAsync(key: string): Promise<DiskCacheEntry | null>;
790
+ /**
791
+ * Delete the index row for `hash` only if it still points at `filePath`.
792
+ * The check and delete are synchronous, so a newer spill cannot slip between
793
+ * them. Returns true when this caller removed the row.
794
+ */
795
+ private deleteIndexRowIfCurrent;
796
+ /** Decode and validate a raw disk payload. Callers own file cleanup. */
797
+ private decodeLoadedPayload;
751
798
  /** Synchronously fence queued/running saves while leaving filesystem cleanup deferred. */
752
799
  invalidate(key: string): void;
800
+ /** Cancel and remove only the observed write; newer pending or stored spills survive. */
801
+ deleteIfRevision(key: string, revision: string): void;
753
802
  /** Delete all versions; deferred cleanup must not cancel a newer save. */
754
803
  delete(key: string, invalidatedOnly?: boolean): void;
755
804
  /** Purge all expired entries. Returns number deleted. */
@@ -809,6 +858,10 @@ declare class DiskTier {
809
858
  };
810
859
  /** Direct access to the bounded write queue for chaos diagnostics and canary controls. */
811
860
  get backpressure(): BoundedDiskQueue;
861
+ /** Wait for admitted physical spill tasks, including work past its caller timeout. */
862
+ drain(timeoutMs?: number): Promise<boolean>;
863
+ /** Wait unboundedly for physical writes and their reservation cleanup before closing the index. */
864
+ whenIdle(): Promise<void>;
812
865
  /** Whether a SQLite metadata index is active ('sqlite') or the disk is scanned directly ('file-only'). */
813
866
  get indexMode(): 'sqlite' | 'file-only';
814
867
  /** Release the SQLite connection (if open). Call during shutdown before deleting the cache directory. */
@@ -891,8 +944,8 @@ interface TimedRedisValue {
891
944
  * Automatically combines individual Redis commands dispatched during the same synchronous
892
945
  * tick of the Node.js event loop into a single `pipeline()` network round-trip.
893
946
  *
894
- * Uses `queueMicrotask` exclusively (never `setImmediate` or timers) to ensure ZERO
895
- * artificial latency penalty (0ms overhead) while slashing network syscalls under high concurrency.
947
+ * Uses `queueMicrotask` rather than a batching timer. Scheduling and command
948
+ * execution still have a cost; timed reads remain atomic within each batch.
896
949
  */
897
950
  declare class AutoPipeliner {
898
951
  private readonly client;
@@ -1003,4 +1056,16 @@ declare function isChildTag(parentTag: string, candidateTag: string, delimiter?:
1003
1056
  */
1004
1057
  declare function expandHierarchicalTags(tags: string[], delimiter?: string): string[];
1005
1058
 
1006
- export { AutoPipeliner, type AutoPipelinerOptions, type AutonomousL1Options, CacheCodec, type CacheCodecOptions, CacheEncryption, CacheHit, CachePriority, CategoryLimit, CompressionAlgorithm, DEFAULT_AUTONOMOUS_L1_CEILING_BYTES, DiskCacheEntry, DiskTier, EvictionReason, type EvictionResult, ILogger, IRedisDriver, IRedisPipeline, IRemoteSnapshotAdapter, MIN_AUTONOMOUS_L1_FLOOR_BYTES, NodeRedisAdapter, type ParsedTraceParent, SigV4SnapshotAdapter, type SigV4SnapshotAdapterOptions, SmartCacheEntry, SmartMemoryCache, TinyLfuSketch, WTinyLfuCache, type WTinyLfuOptions, WTinyLfuPolicy, type WTinyLfuStats, createNodeRedisAdapter, createR2SnapshotAdapter, createS3SnapshotAdapter, createSigV4SnapshotAdapter, defaultCodec, expandHierarchicalTags, formatTraceParent, getV8HeapLimit, isChildTag, isWildcardTag, matchesTagPattern, parseTraceParent, readCgroupMemoryLimit, resolveAutonomousL1MaxBytes, resolveDefaultDiskDir };
1059
+ /** Fail before allocating queues or starting user work. No implicit retry. */
1060
+ declare class CacheCapacityError extends Error {
1061
+ constructor(resource: string);
1062
+ }
1063
+
1064
+ /** Thrown when the opt-in read gate lacks fresh invalidation consumer proof. */
1065
+ declare class CacheInvalidationUnavailableError extends Error {
1066
+ readonly reason: string;
1067
+ readonly detectedAt: number | null;
1068
+ constructor(reason: string, detectedAt: number | null);
1069
+ }
1070
+
1071
+ export { AutoPipeliner, type AutoPipelinerOptions, type AutonomousL1Options, CacheCapacityError, CacheCodec, type CacheCodecOptions, CacheEncryption, CacheHit, CacheInvalidationUnavailableError, CachePriority, CategoryLimit, CompressionAlgorithm, DEFAULT_AUTONOMOUS_L1_CEILING_BYTES, DiskCacheEntry, DiskTier, EvictionReason, type EvictionResult, ILogger, IRedisDriver, IRedisPipeline, IRemoteSnapshotAdapter, MIN_AUTONOMOUS_L1_FLOOR_BYTES, NodeRedisAdapter, type ParsedTraceParent, SigV4SnapshotAdapter, type SigV4SnapshotAdapterOptions, SmartCacheEntry, SmartMemoryCache, SnapshotRequestOptions, SnapshotTransferOptions, TinyLfuSketch, WTinyLfuCache, type WTinyLfuOptions, WTinyLfuPolicy, type WTinyLfuStats, createNodeRedisAdapter, createR2SnapshotAdapter, createS3SnapshotAdapter, createSigV4SnapshotAdapter, defaultCodec, expandHierarchicalTags, formatTraceParent, getV8HeapLimit, isChildTag, isWildcardTag, matchesTagPattern, parseTraceParent, readCgroupMemoryLimit, resolveAutonomousL1MaxBytes, resolveDefaultDiskDir };