*/ private array $instances = []; public function __construct( private readonly UpstreamSourceRegistry $sources, private readonly CacheManager $cacheManager, ) { } public function forSource(string $source): UpstreamQueryCache { $key = $this->sources->definition($source)['key']; return $this->instances[$key] ??= new UpstreamQueryCache( $this->sources, $key, $this->cacheManager ); } }