Function cached

  • A cache helper to cache single functions and their return variable.

    Type Parameters

    • T

    Parameters

    • func: ((id: string) => Promise<T>)

      The function to cache.

        • (id): Promise<T>
        • Parameters

          • id: string

          Returns Promise<T>

    Returns ((id: string) => Promise<T>)

    • A function which upon subsequent calls with the same id parameter returns the result from the first call.
      • (id): Promise<T>
      • Parameters

        • id: string

        Returns Promise<T>