ZendDataCache.php 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. <?php
  2. namespace Doctrine\Common\Cache;
  3. use function zend_shm_cache_clear;
  4. use function zend_shm_cache_delete;
  5. use function zend_shm_cache_fetch;
  6. use function zend_shm_cache_store;
  7. /**
  8. * Zend Data Cache cache driver.
  9. *
  10. * @deprecated Deprecated without replacement in doctrine/cache 1.11. This class will be dropped in 2.0
  11. *
  12. * @link www.doctrine-project.org
  13. */
  14. class ZendDataCache extends CacheProvider
  15. {
  16. /**
  17. * {@inheritdoc}
  18. */
  19. protected function doFetch($id)
  20. {
  21. return zend_shm_cache_fetch($id);
  22. }
  23. /**
  24. * {@inheritdoc}
  25. */
  26. protected function doContains($id)
  27. {
  28. return zend_shm_cache_fetch($id) !== false;
  29. }
  30. /**
  31. * {@inheritdoc}
  32. */
  33. protected function doSave($id, $data, $lifeTime = 0)
  34. {
  35. return zend_shm_cache_store($id, $data, $lifeTime);
  36. }
  37. /**
  38. * {@inheritdoc}
  39. */
  40. protected function doDelete($id)
  41. {
  42. return zend_shm_cache_delete($id);
  43. }
  44. /**
  45. * {@inheritdoc}
  46. */
  47. protected function doFlush()
  48. {
  49. $namespace = $this->getNamespace();
  50. if (empty($namespace)) {
  51. return zend_shm_cache_clear();
  52. }
  53. return zend_shm_cache_clear($namespace);
  54. }
  55. /**
  56. * {@inheritdoc}
  57. */
  58. protected function doGetStats()
  59. {
  60. return null;
  61. }
  62. }