layercache 1.2.6 → 1.2.8

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.
@@ -343,6 +343,21 @@ interface CacheStackEvents {
343
343
  warm: {
344
344
  key: string;
345
345
  };
346
+ /** Fired immediately before a high-level cache operation begins. */
347
+ 'operation-start': {
348
+ id: number;
349
+ name: string;
350
+ attributes?: Record<string, unknown>;
351
+ };
352
+ /** Fired after a high-level cache operation finishes. */
353
+ 'operation-end': {
354
+ id: number;
355
+ name: string;
356
+ attributes?: Record<string, unknown>;
357
+ success: boolean;
358
+ result?: 'null';
359
+ error?: unknown;
360
+ };
346
361
  /** Fired when an error occurs (layer failure, circuit breaker, etc.). */
347
362
  error: {
348
363
  operation: string;
@@ -424,17 +439,16 @@ declare class CacheStack extends EventEmitter {
424
439
  private readonly keyDiscovery;
425
440
  private readonly fetchRateLimiter;
426
441
  private readonly snapshotSerializer;
442
+ private readonly invalidation;
443
+ private readonly layerWriter;
444
+ private readonly snapshots;
427
445
  private readonly backgroundRefreshes;
428
446
  private readonly layerDegradedUntil;
429
- private readonly keyEpochs;
447
+ private readonly maintenance;
430
448
  private readonly ttlResolver;
431
449
  private readonly circuitBreakerManager;
450
+ private nextOperationId;
432
451
  private currentGeneration?;
433
- private readonly writeBehindQueue;
434
- private writeBehindTimer?;
435
- private writeBehindFlushPromise?;
436
- private generationCleanupPromise?;
437
- private clearEpoch;
438
452
  private isDisconnecting;
439
453
  private disconnectPromise?;
440
454
  constructor(layers: CacheLayer[], options?: CacheStackOptions);
@@ -530,8 +544,6 @@ declare class CacheStack extends EventEmitter {
530
544
  private readFromLayers;
531
545
  private readLayerEntry;
532
546
  private backfill;
533
- private writeAcrossLayers;
534
- private executeLayerOperations;
535
547
  private resolveFreshTtl;
536
548
  private resolveLayerSeconds;
537
549
  private shouldNegativeCache;
@@ -546,25 +558,17 @@ declare class CacheStack extends EventEmitter {
546
558
  private sleep;
547
559
  private withTimeout;
548
560
  private shouldBroadcastL1Invalidation;
549
- private shouldCleanupGenerations;
550
- private generationCleanupBatchSize;
561
+ private observeOperation;
551
562
  private scheduleGenerationCleanup;
552
563
  private cleanupGeneration;
553
564
  private initializeWriteBehind;
554
565
  private shouldWriteBehind;
555
- private beginClearEpoch;
556
- private currentKeyEpoch;
557
- private bumpKeyEpochs;
558
- private isWriteOutdated;
559
566
  private enqueueWriteBehind;
560
567
  private flushWriteBehindQueue;
561
- private buildLayerSetEntry;
562
- private intersectKeys;
568
+ private runWriteBehindBatch;
563
569
  private qualifyKey;
564
570
  private qualifyPattern;
565
571
  private stripQualifiedKey;
566
- private generationPrefix;
567
- private deleteKeysFromLayers;
568
572
  private validateConfiguration;
569
573
  private validateWriteOptions;
570
574
  private assertActive;
@@ -577,14 +581,9 @@ declare class CacheStack extends EventEmitter {
577
581
  private recordCircuitFailure;
578
582
  private isNegativeStoredValue;
579
583
  private emitError;
580
- private isCacheSnapshotEntries;
581
- private sanitizeSnapshotValue;
582
584
  private snapshotMaxBytes;
583
585
  private snapshotMaxEntries;
584
586
  private invalidationMaxKeys;
585
- private collectKeysForTag;
586
- private assertWithinInvalidationKeyLimit;
587
- private visitExportEntries;
588
587
  }
589
588
 
590
589
  interface CacheableOptions<TArgs extends unknown[]> extends CacheWrapOptions<TArgs> {
@@ -343,6 +343,21 @@ interface CacheStackEvents {
343
343
  warm: {
344
344
  key: string;
345
345
  };
346
+ /** Fired immediately before a high-level cache operation begins. */
347
+ 'operation-start': {
348
+ id: number;
349
+ name: string;
350
+ attributes?: Record<string, unknown>;
351
+ };
352
+ /** Fired after a high-level cache operation finishes. */
353
+ 'operation-end': {
354
+ id: number;
355
+ name: string;
356
+ attributes?: Record<string, unknown>;
357
+ success: boolean;
358
+ result?: 'null';
359
+ error?: unknown;
360
+ };
346
361
  /** Fired when an error occurs (layer failure, circuit breaker, etc.). */
347
362
  error: {
348
363
  operation: string;
@@ -424,17 +439,16 @@ declare class CacheStack extends EventEmitter {
424
439
  private readonly keyDiscovery;
425
440
  private readonly fetchRateLimiter;
426
441
  private readonly snapshotSerializer;
442
+ private readonly invalidation;
443
+ private readonly layerWriter;
444
+ private readonly snapshots;
427
445
  private readonly backgroundRefreshes;
428
446
  private readonly layerDegradedUntil;
429
- private readonly keyEpochs;
447
+ private readonly maintenance;
430
448
  private readonly ttlResolver;
431
449
  private readonly circuitBreakerManager;
450
+ private nextOperationId;
432
451
  private currentGeneration?;
433
- private readonly writeBehindQueue;
434
- private writeBehindTimer?;
435
- private writeBehindFlushPromise?;
436
- private generationCleanupPromise?;
437
- private clearEpoch;
438
452
  private isDisconnecting;
439
453
  private disconnectPromise?;
440
454
  constructor(layers: CacheLayer[], options?: CacheStackOptions);
@@ -530,8 +544,6 @@ declare class CacheStack extends EventEmitter {
530
544
  private readFromLayers;
531
545
  private readLayerEntry;
532
546
  private backfill;
533
- private writeAcrossLayers;
534
- private executeLayerOperations;
535
547
  private resolveFreshTtl;
536
548
  private resolveLayerSeconds;
537
549
  private shouldNegativeCache;
@@ -546,25 +558,17 @@ declare class CacheStack extends EventEmitter {
546
558
  private sleep;
547
559
  private withTimeout;
548
560
  private shouldBroadcastL1Invalidation;
549
- private shouldCleanupGenerations;
550
- private generationCleanupBatchSize;
561
+ private observeOperation;
551
562
  private scheduleGenerationCleanup;
552
563
  private cleanupGeneration;
553
564
  private initializeWriteBehind;
554
565
  private shouldWriteBehind;
555
- private beginClearEpoch;
556
- private currentKeyEpoch;
557
- private bumpKeyEpochs;
558
- private isWriteOutdated;
559
566
  private enqueueWriteBehind;
560
567
  private flushWriteBehindQueue;
561
- private buildLayerSetEntry;
562
- private intersectKeys;
568
+ private runWriteBehindBatch;
563
569
  private qualifyKey;
564
570
  private qualifyPattern;
565
571
  private stripQualifiedKey;
566
- private generationPrefix;
567
- private deleteKeysFromLayers;
568
572
  private validateConfiguration;
569
573
  private validateWriteOptions;
570
574
  private assertActive;
@@ -577,14 +581,9 @@ declare class CacheStack extends EventEmitter {
577
581
  private recordCircuitFailure;
578
582
  private isNegativeStoredValue;
579
583
  private emitError;
580
- private isCacheSnapshotEntries;
581
- private sanitizeSnapshotValue;
582
584
  private snapshotMaxBytes;
583
585
  private snapshotMaxEntries;
584
586
  private invalidationMaxKeys;
585
- private collectKeysForTag;
586
- private assertWithinInvalidationKeyLimit;
587
- private visitExportEntries;
588
587
  }
589
588
 
590
589
  interface CacheableOptions<TArgs extends unknown[]> extends CacheWrapOptions<TArgs> {