@vsokolov/utils - v1.4.2
    Preparing search index...

    Interface LRUCacheAPI<T>

    LRU cache API with TTL support

    interface LRUCacheAPI<T = unknown> {
        get: (key: string) => Maybe<T>;
        set: (key: string, value: T) => void;
        has: (key: string) => boolean;
        remove: (key: string) => boolean;
        clear: () => void;
        size: number;
    }

    Type Parameters

    • T = unknown

    Hierarchy (View Summary)

    Index

    Properties

    Properties

    get: (key: string) => Maybe<T>

    Get a value, returning null if expired or not found

    set: (key: string, value: T) => void

    Set a value with automatic expiration based on TTL

    has: (key: string) => boolean

    Check if key exists and hasn't expired

    remove: (key: string) => boolean

    Delete a key from cache

    clear: () => void

    Clear all entries

    size: number

    Current number of entries