@adobe/data - v0.10.30
    Preparing search index...

    Function getCached

    • Gets a cached value for an object using a factory function. If the value hasn't been cached yet, the factory function will be called to create it. The cache is stored on the object itself using a WeakMap, allowing for garbage collection when the object is no longer referenced.

      Type Parameters

      • A extends object
      • B

      Parameters

      • context: A

        The object to cache the value on

      • factory: (obj: A) => B

        A function that creates the value to be cached

      Returns B

      The cached value or a newly created value from the factory