ProxyTrait.php 817 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. <?php
  2. /*
  3. * This file is part of the Symfony package.
  4. *
  5. * (c) Fabien Potencier <fabien@symfony.com>
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. namespace Symfony\Component\Cache\Traits;
  11. use Symfony\Component\Cache\PruneableInterface;
  12. use Symfony\Contracts\Service\ResetInterface;
  13. /**
  14. * @author Nicolas Grekas <p@tchwork.com>
  15. *
  16. * @internal
  17. */
  18. trait ProxyTrait
  19. {
  20. private $pool;
  21. /**
  22. * {@inheritdoc}
  23. */
  24. public function prune()
  25. {
  26. return $this->pool instanceof PruneableInterface && $this->pool->prune();
  27. }
  28. /**
  29. * {@inheritdoc}
  30. */
  31. public function reset()
  32. {
  33. if ($this->pool instanceof ResetInterface) {
  34. $this->pool->reset();
  35. }
  36. }
  37. }