Function createDeferredCachedValue

  • Create and return a readonly ICachedValue instance which will cache and return the value returned by the callback function. The callback function will only be called once, multiple access of the value will not cause re-execution of the callback as the result from the first call is cached internally. This is a lightweight version of getLazy which does not support any expiration or invalidation, it also will not honor the setBypassLazyCache setting and will always return the provided value.

    Type Parameters

    • T

    Parameters

    • cb: (() => T)

      The callback function to fetch the value to be lazily evaluated and cached

        • (): T
        • Returns T

    Returns ICachedValue<T>

    Since

    0.10.5

    Typeparam

    T - The type of the value to be cached