• Returns the cache entry by a specific key of a given reference. If the cache is not filled and the key doesn't exisit this will retrun undefined.

    Type Parameters

    • T = unknown

      is the type of the cached value

    Parameters

    • ref: object

      the reference

    • key: string

      the storage key

    Returns T | undefined

    the cached value or undefined

  • Returns the cache entry by a specific key of a given reference. If the cache is not filled and the key doesn't exisit, the factory function is called to generate a value. This value will be cached and returned.

    Type Parameters

    • T = unknown

      is the type of the cached value

    Parameters

    • ref: object

      the reference

    • key: string

      the storage key

    • factory: (() => T)

      the factory function

        • (): T
        • Returns T

    Returns T

    the cached value