DoctrineCacheAdapter.php 869 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. <?php
  2. namespace Guzzle\Cache;
  3. use Doctrine\Common\Cache\Cache;
  4. /**
  5. * Doctrine 2 cache adapter
  6. *
  7. * @link http://www.doctrine-project.org/
  8. */
  9. class DoctrineCacheAdapter extends AbstractCacheAdapter
  10. {
  11. /**
  12. * @param Cache $cache Doctrine cache object
  13. */
  14. public function __construct(Cache $cache)
  15. {
  16. $this->cache = $cache;
  17. }
  18. public function contains($id, array $options = null)
  19. {
  20. return $this->cache->contains($id);
  21. }
  22. public function delete($id, array $options = null)
  23. {
  24. return $this->cache->delete($id);
  25. }
  26. public function fetch($id, array $options = null)
  27. {
  28. return $this->cache->fetch($id);
  29. }
  30. public function save($id, $data, $lifeTime = false, array $options = null)
  31. {
  32. return $this->cache->save($id, $data, $lifeTime !== false ? $lifeTime : 0);
  33. }
  34. }