layercache 1.3.3 → 1.3.4

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.
package/README.md CHANGED
@@ -19,7 +19,7 @@
19
19
  <a href="./LICENSE"><img src="https://img.shields.io/badge/license-Apache_2.0-green" alt="license"></a>
20
20
  <a href="https://www.typescriptlang.org/"><img src="https://img.shields.io/badge/TypeScript-first-3178C6?logo=typescript&logoColor=white" alt="TypeScript"></a>
21
21
  <img src="https://img.shields.io/badge/Node.js-%E2%89%A5_20-339933?logo=nodedotjs&logoColor=white" alt="Node.js >= 20">
22
- <img src="https://img.shields.io/badge/tests-467_passing-brightgreen" alt="tests">
22
+ <img src="https://img.shields.io/badge/tests-529_passing-brightgreen" alt="tests">
23
23
  <a href="https://coveralls.io/github/flyingsquirrel0419/layercache?branch=main"><img src="https://coveralls.io/repos/github/flyingsquirrel0419/layercache/badge.svg?branch=main&t=20260410" alt="Coveralls"></a>
24
24
  </p>
25
25
 
@@ -557,8 +557,6 @@ declare class CacheStack extends EventEmitter {
557
557
  private readonly invalidation;
558
558
  private readonly layerWriter;
559
559
  private readonly snapshots;
560
- private readonly backgroundRefreshes;
561
- private readonly backgroundRefreshAbort;
562
560
  private readonly layerDegradedUntil;
563
561
  private readonly maintenance;
564
562
  private readonly ttlResolver;
@@ -566,6 +564,7 @@ declare class CacheStack extends EventEmitter {
566
564
  private nextOperationId;
567
565
  private currentGeneration?;
568
566
  private isDisconnecting;
567
+ private readonly reader;
569
568
  private disconnectPromise?;
570
569
  constructor(layers: CacheLayer[], options?: CacheStackOptions);
571
570
  /**
@@ -575,7 +574,6 @@ declare class CacheStack extends EventEmitter {
575
574
  * and no `fetcher` is provided.
576
575
  */
577
576
  get<T>(key: string, fetcher?: () => Promise<T>, options?: CacheGetOptions): Promise<T | null>;
578
- private getPrepared;
579
577
  /**
580
578
  * Alias for `get(key, fetcher, options)` — explicit get-or-set pattern.
581
579
  * Fetches and caches the value if not already present.
@@ -652,20 +650,10 @@ declare class CacheStack extends EventEmitter {
652
650
  restoreFromFile(filePath: string): Promise<void>;
653
651
  disconnect(): Promise<void>;
654
652
  private initialize;
655
- private fetchWithGuards;
656
- private waitForFreshValue;
657
- private fetchAndPopulate;
658
653
  private storeEntry;
659
654
  private writeBatch;
660
- private readFromLayers;
661
- private readLayerEntry;
662
- private backfill;
663
655
  private resolveFreshTtl;
664
656
  private resolveLayerSeconds;
665
- private shouldNegativeCache;
666
- private scheduleBackgroundRefresh;
667
- private runBackgroundRefresh;
668
- private resolveSingleFlightOptions;
669
657
  private deleteKeys;
670
658
  private publishInvalidation;
671
659
  private handleInvalidationMessage;
@@ -689,13 +677,14 @@ declare class CacheStack extends EventEmitter {
689
677
  private validateWriteOptions;
690
678
  private assertActive;
691
679
  private awaitStartup;
680
+ private readLayerEntry;
681
+ private scheduleBackgroundRefresh;
692
682
  private applyFreshReadPolicies;
693
683
  private shouldSkipLayer;
694
684
  private handleLayerFailure;
695
685
  private reportRecoverableLayerFailure;
696
686
  private isGracefulDegradationEnabled;
697
687
  private recordCircuitFailure;
698
- private isNegativeStoredValue;
699
688
  private emitError;
700
689
  private snapshotMaxBytes;
701
690
  private snapshotMaxEntries;
@@ -557,8 +557,6 @@ declare class CacheStack extends EventEmitter {
557
557
  private readonly invalidation;
558
558
  private readonly layerWriter;
559
559
  private readonly snapshots;
560
- private readonly backgroundRefreshes;
561
- private readonly backgroundRefreshAbort;
562
560
  private readonly layerDegradedUntil;
563
561
  private readonly maintenance;
564
562
  private readonly ttlResolver;
@@ -566,6 +564,7 @@ declare class CacheStack extends EventEmitter {
566
564
  private nextOperationId;
567
565
  private currentGeneration?;
568
566
  private isDisconnecting;
567
+ private readonly reader;
569
568
  private disconnectPromise?;
570
569
  constructor(layers: CacheLayer[], options?: CacheStackOptions);
571
570
  /**
@@ -575,7 +574,6 @@ declare class CacheStack extends EventEmitter {
575
574
  * and no `fetcher` is provided.
576
575
  */
577
576
  get<T>(key: string, fetcher?: () => Promise<T>, options?: CacheGetOptions): Promise<T | null>;
578
- private getPrepared;
579
577
  /**
580
578
  * Alias for `get(key, fetcher, options)` — explicit get-or-set pattern.
581
579
  * Fetches and caches the value if not already present.
@@ -652,20 +650,10 @@ declare class CacheStack extends EventEmitter {
652
650
  restoreFromFile(filePath: string): Promise<void>;
653
651
  disconnect(): Promise<void>;
654
652
  private initialize;
655
- private fetchWithGuards;
656
- private waitForFreshValue;
657
- private fetchAndPopulate;
658
653
  private storeEntry;
659
654
  private writeBatch;
660
- private readFromLayers;
661
- private readLayerEntry;
662
- private backfill;
663
655
  private resolveFreshTtl;
664
656
  private resolveLayerSeconds;
665
- private shouldNegativeCache;
666
- private scheduleBackgroundRefresh;
667
- private runBackgroundRefresh;
668
- private resolveSingleFlightOptions;
669
657
  private deleteKeys;
670
658
  private publishInvalidation;
671
659
  private handleInvalidationMessage;
@@ -689,13 +677,14 @@ declare class CacheStack extends EventEmitter {
689
677
  private validateWriteOptions;
690
678
  private assertActive;
691
679
  private awaitStartup;
680
+ private readLayerEntry;
681
+ private scheduleBackgroundRefresh;
692
682
  private applyFreshReadPolicies;
693
683
  private shouldSkipLayer;
694
684
  private handleLayerFailure;
695
685
  private reportRecoverableLayerFailure;
696
686
  private isGracefulDegradationEnabled;
697
687
  private recordCircuitFailure;
698
- private isNegativeStoredValue;
699
688
  private emitError;
700
689
  private snapshotMaxBytes;
701
690
  private snapshotMaxEntries;
package/dist/edge.d.cts CHANGED
@@ -1,2 +1,2 @@
1
- export { e as CacheGetOptions, f as CacheLayer, h as CacheLayerSetManyEntry, t as CacheMetricsSnapshot, w as CacheRateLimitOptions, B as CacheTtlPolicy, D as CacheTtlPolicyContext, J as CacheWriteOptions, K as EvictionPolicy, M as MemoryLayer, N as MemoryLayerOptions, O as MemoryLayerSnapshotEntry, P as PatternMatcher, T as TagIndex, Q as createHonoCacheMiddleware } from './edge-CUHTP9Bc.cjs';
1
+ export { e as CacheGetOptions, f as CacheLayer, h as CacheLayerSetManyEntry, t as CacheMetricsSnapshot, w as CacheRateLimitOptions, B as CacheTtlPolicy, D as CacheTtlPolicyContext, J as CacheWriteOptions, K as EvictionPolicy, M as MemoryLayer, N as MemoryLayerOptions, O as MemoryLayerSnapshotEntry, P as PatternMatcher, T as TagIndex, Q as createHonoCacheMiddleware } from './edge-DKkrQ_Ky.cjs';
2
2
  import 'node:events';
package/dist/edge.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export { e as CacheGetOptions, f as CacheLayer, h as CacheLayerSetManyEntry, t as CacheMetricsSnapshot, w as CacheRateLimitOptions, B as CacheTtlPolicy, D as CacheTtlPolicyContext, J as CacheWriteOptions, K as EvictionPolicy, M as MemoryLayer, N as MemoryLayerOptions, O as MemoryLayerSnapshotEntry, P as PatternMatcher, T as TagIndex, Q as createHonoCacheMiddleware } from './edge-CUHTP9Bc.js';
1
+ export { e as CacheGetOptions, f as CacheLayer, h as CacheLayerSetManyEntry, t as CacheMetricsSnapshot, w as CacheRateLimitOptions, B as CacheTtlPolicy, D as CacheTtlPolicyContext, J as CacheWriteOptions, K as EvictionPolicy, M as MemoryLayer, N as MemoryLayerOptions, O as MemoryLayerSnapshotEntry, P as PatternMatcher, T as TagIndex, Q as createHonoCacheMiddleware } from './edge-DKkrQ_Ky.js';
2
2
  import 'node:events';