<?php

/**
 * This file contains \QUI\TemplateAvadaAgency\EventHandler
 */

namespace QUI\TemplateAvadaAgency;

use QUI;

/**
 * Event Class
 *
 * @author www.pcsg.de (Michael Danielczok)
 */
class EventHandler
{
    /**
     * Clear system cache on project save
     *
     * @return void
     */
    public static function onProjectConfigSave(): void
    {
        QUI\Cache\Manager::clear('quiqqer/templateAvadaAgency');
    }

    /**
     * Clear system cache on site save
     *
     */
    public static function onSiteSave(QUI\Interfaces\Projects\Site $Site): void
    {
        $Project   = $Site->getProject();
        $cacheName = md5($Project->getName() . $Project->getLang() . $Site->getId());

        QUI\Cache\Manager::clear('quiqqer/templateAvadaAgency/' . $cacheName);
    }
}
