src/Core/Framework/Adapter/Cache/Script/ScriptCacheInvalidationSubscriber.php line 27
<?php declare(strict_types=1);
namespace Shopware\Core\Framework\Adapter\Cache\Script;
use Shopware\Core\Framework\DataAbstractionLayer\Event\EntityWrittenContainerEvent;
use Shopware\Core\Framework\Log\Package;
use Shopware\Core\Framework\Script\Execution\ScriptExecutor;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
/**
* @internal
*/
#[Package('core')]
class ScriptCacheInvalidationSubscriber implements EventSubscriberInterface
{
public function __construct(private readonly ScriptExecutor $scriptExecutor)
{
}
public static function getSubscribedEvents(): array
{
return [
EntityWrittenContainerEvent::class => 'executeCacheInvalidationHook',
];
}
public function executeCacheInvalidationHook(EntityWrittenContainerEvent $event): void
{
$this->scriptExecutor->execute(
new CacheInvalidationHook($event)
);
}
}