<?php


namespace AutoAdmin\Bundle\Admin\Controller\Admin;

use AutoAdmin\Bundle\Cache\Service\CacheService;
use Symfony\Component\HttpFoundation\Request;

/**
 * Class EntityController
 * @package AutoAdmin\Bundle\Admin\Controller\Admin
 *
 */
class CacheRuleController extends EntityController
{
    private CacheService $cacheService;

    /**
     * @required
     */
    public function setCacheService(CacheService $service)
    {
        $this->cacheService = $service;
    }

    public function cacheClear(Request $request)
    {
        $this->cacheService->clearCachedResponse();

        return $this->redirect($request->headers->get('referer'));
    }
}
