repletes - v1.1.0
    Preparing search index...

    Type Alias Event

    Event:
        | {
            age: number;
            key: string;
            state: "fresh"
            | "stale"
            | "retained";
            type: "hit";
        }
        | { key: string; type: "miss" }
        | { key: string; retainFor: number; type: "write" }
        | { key: string; type: "skip" }
        | { key: string; ok: boolean; type: "refresh" }
        | { age: number; key: string; type: "served-stale" }
        | {
            background: boolean;
            error: unknown;
            key: string;
            type: "action-error";
        }
        | {
            error: unknown;
            key: string;
            operation: "get"
            | "set"
            | "delete"
            | "clear";
            type: "store-error";
        }

    Everything observable. Reported, never thrown.

    action-error and store-error carry what went wrong; the rest are facts about what the cache did, so a listener counts them without unpacking an error it does not need.

    Type Declaration

    • { age: number; key: string; state: "fresh" | "stale" | "retained"; type: "hit" }
    • { key: string; type: "miss" }
    • { key: string; retainFor: number; type: "write" }
    • { key: string; type: "skip" }
    • { key: string; ok: boolean; type: "refresh" }
    • { age: number; key: string; type: "served-stale" }
    • { background: boolean; error: unknown; key: string; type: "action-error" }

      The action failed. Emitted wherever an action throws (on a miss before the error is rethrown, under a retained entry before it is served, and behind a stale read), so that upstream failure rate is one count rather than three. background marks the refresh case, which no caller awaited.

    • {
          error: unknown;
          key: string;
          operation: "get" | "set" | "delete" | "clear";
          type: "store-error";
      }