bundle/w3des/AdminBundle/src/Cache/SkippableFilesystemTagAwareAdapter.php line 22

Open in your IDE?
  1. <?php
  2. namespace w3des\AdminBundle\Cache;
  3. use Symfony\Contracts\Cache\TagAwareCacheInterface;
  4. use Symfony\Component\Cache\Adapter\ChainAdapter;
  5. use Symfony\Component\Cache\Adapter\TagAwareAdapterInterface;
  6. use Symfony\Component\Cache\Adapter\FilesystemTagAwareAdapter;
  7. class SkippableFilesystemTagAwareAdapter extends FilesystemTagAwareAdapter
  8. {
  9. private bool $enabled = true;
  10. public function enabled($enabled)
  11. {
  12. $this->enabled = $enabled;
  13. }
  14. /**
  15. * {@inheritDoc}
  16. */
  17. public function get(string $key, callable $callback, float $beta = null, array &$metadata = null)
  18. {
  19. return parent::get($key, $callback, $this->enabled ? $beta : INF, $metadata);
  20. }
  21. public function invalidateTags(array $tags)
  22. {
  23. return parent::invalidateTags($tags);
  24. }
  25. }