Member Junction
    Preparing search index...

    Interface MJLruCacheOptions<K, V>

    Options for MJLruCache. All fields are optional — defaults give a 1000-entry, no-TTL cache.

    interface MJLruCacheOptions<K, V> {
        maxSize?: number;
        onEvict?: (
            key: K,
            value: V,
            reason: "delete" | "lru" | "ttl" | "clear",
        ) => void;
        ttlMs?: number;
    }

    Type Parameters

    • K
    • V
    Index

    Properties

    maxSize?: number

    Maximum number of entries before LRU eviction kicks in. Default 1000.

    onEvict?: (key: K, value: V, reason: "delete" | "lru" | "ttl" | "clear") => void

    Optional callback fired when an entry is evicted (LRU overflow, TTL expiry, or explicit Delete/Clear). Useful for releasing handles owned by V (e.g., calling .destroy() on an SDK client).

    ttlMs?: number

    Time-to-live in milliseconds. When set, entries older than this are treated as missing on Get() and evicted lazily. Use 0 or undefined to disable TTL.