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.
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.