@samatawy/rules
    Preparing search index...

    Interface ICache

    interface ICache {
        setCache(id: string, value: any): void;
        getCached(id: string): any;
        clearCache(id?: string): void;
        getCacheMetrics(): { sets: number; hits: number; misses: number };
    }

    Hierarchy (View Summary)

    Index

    Methods

    • Keep a value under a given identifier.

      Parameters

      • id: string

        the identifier to set,

      • value: any

        the value to keep for the identifier.

      Returns void

    • Get the value kept under a given identifer.

      Parameters

      • id: string

        the identifer to look for.

      Returns any

      the value kept under that identifer, or undefined if the id was not found.

    • Delete a single identifier and its value, or entirely delete all values.

      Parameters

      • Optionalid: string

        the identifier to delete. If not provided, the entire cache will be cleared.

      Returns void

    • Retrieve metrics for this cache instance. This is mainly a debugging/monitoring method.

      Returns { sets: number; hits: number; misses: number }

      a metrics object containing sets, hits, and misses.