ExternalAdapter.php 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  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\Tests\Fixtures;
  11. use Psr\Cache\CacheItemInterface;
  12. use Psr\Cache\CacheItemPoolInterface;
  13. use Symfony\Component\Cache\Adapter\ArrayAdapter;
  14. /**
  15. * Adapter not implementing the {@see \Symfony\Component\Cache\Adapter\AdapterInterface}.
  16. *
  17. * @author Kévin Dunglas <dunglas@gmail.com>
  18. */
  19. class ExternalAdapter implements CacheItemPoolInterface
  20. {
  21. private $cache;
  22. public function __construct()
  23. {
  24. $this->cache = new ArrayAdapter();
  25. }
  26. public function getItem($key)
  27. {
  28. return $this->cache->getItem($key);
  29. }
  30. public function getItems(array $keys = [])
  31. {
  32. return $this->cache->getItems($keys);
  33. }
  34. public function hasItem($key)
  35. {
  36. return $this->cache->hasItem($key);
  37. }
  38. public function clear()
  39. {
  40. return $this->cache->clear();
  41. }
  42. public function deleteItem($key)
  43. {
  44. return $this->cache->deleteItem($key);
  45. }
  46. public function deleteItems(array $keys)
  47. {
  48. return $this->cache->deleteItems($keys);
  49. }
  50. public function save(CacheItemInterface $item)
  51. {
  52. return $this->cache->save($item);
  53. }
  54. public function saveDeferred(CacheItemInterface $item)
  55. {
  56. return $this->cache->saveDeferred($item);
  57. }
  58. public function commit()
  59. {
  60. return $this->cache->commit();
  61. }
  62. }