<?php
namespace w3des\AdminBundle\Cache;
use Symfony\Contracts\Cache\TagAwareCacheInterface;
use Symfony\Component\Cache\Adapter\ChainAdapter;
use Symfony\Component\Cache\Adapter\TagAwareAdapterInterface;
use Symfony\Component\Cache\Adapter\FilesystemTagAwareAdapter;
class SkippableFilesystemTagAwareAdapter extends FilesystemTagAwareAdapter
{
private bool $enabled = true;
public function enabled($enabled)
{
$this->enabled = $enabled;
}
/**
* {@inheritDoc}
*/
public function get(string $key, callable $callback, float $beta = null, array &$metadata = null)
{
return parent::get($key, $callback, $this->enabled ? $beta : INF, $metadata);
}
public function invalidateTags(array $tags)
{
return parent::invalidateTags($tags);
}
}