Member Junction
    Preparing search index...

    Interface LocalCacheManagerConfig

    Configuration for the LocalCacheManager

    interface LocalCacheManagerConfig {
        defaultTTLMs: number;
        enabled: boolean;
        evictionPolicy: "lru" | "lfu" | "fifo";
        evictionSweepIntervalMs: number;
        maxEntryPercentOfCache: number | "auto";
        maxPercentOfCachePerEntity: number;
        maxSizeBytes: number;
        verboseLogging: boolean;
    }
    Index

    Properties

    defaultTTLMs: number

    Default TTL in milliseconds (default: 0 = no TTL, rely on event-based invalidation)

    enabled: boolean

    Whether caching is enabled

    evictionPolicy: "lru" | "lfu" | "fifo"

    Eviction policy when cache is full

    evictionSweepIntervalMs: number

    Interval in milliseconds for the periodic eviction sweep. Catches entries that should have been evicted (TTL expired) but weren't because no new stores triggered eviction. 0 = disabled. Default: 300000 (5 minutes).

    maxEntryPercentOfCache: number | "auto"

    Ceiling on the size of any ONE cache entry. An entry estimated larger than the ceiling is not cached at all — the write is skipped (logged, data still returned to the caller uncached). Applies to RunView and RunQuery entries.

    The ceiling exists because an entry that cannot be RETAINED within the budget is worse than no entry: it evicts other entries to make room and is itself evicted on the next store, so the cache churns and nothing is ever served from it.

    Three modes:

    • 'auto' (default): the ceiling is DERIVED from the budget — everything except a reserve of SINGLE_ENTRY_RESERVE_PERCENT held back for the rest of the cache. This is deliberately not a small fixed fraction: a fixed fraction sized for a small tenant makes the one entity worth caching (the biggest one) permanently uncacheable, which is the failure this mode exists to avoid. The only entries 'auto' declines are entries that genuinely cannot be retained — and the decline message says which maxMemoryMB would admit them.
    • a positive number: an explicit percentage of maxSizeBytes, for an operator who wants a stricter ceiling than 'auto'. Clamped to HARD_MAX_ENTRY_PERCENT — no configuration may admit an entry that leaves the cache less free space than one eviction cycle needs.
    • 0: no ceiling at all (the original, unguarded behaviour — not recommended).
    maxPercentOfCachePerEntity: number

    Maximum percentage of total cache memory (maxSizeBytes) that any single entity's cached results can occupy. When exceeded, the least-recently-accessed entries for that entity are evicted. Default: 50. Set to 0 to disable.

    maxSizeBytes: number

    Maximum cache size in bytes (default: 150MB)

    verboseLogging: boolean

    Enable verbose cache logging (hits, misses, evictions, memory stats). Default: false.