<?php

declare(strict_types=1);

namespace App\Framework\LiveComponents\Performance;

use App\Framework\Cache\Cache;
use App\Framework\DI\Initializer;

final readonly class ComponentMetadataCacheInitializer
{
    public function __construct(
        private Cache $cache
    ) {
    }

    #[Initializer]
    public function __invoke(): ComponentMetadataCacheInterface
    {
        $compiler = new ComponentMetadataCompiler();
        $cache = new ComponentMetadataCache($this->cache, $compiler);

        return $cache;
    }
}
