FrontendInterface.php 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\Framework\Cache;
  7. /**
  8. * Interface of a cache frontend - an ultimate publicly available interface to an actual cache storage
  9. *
  10. * @api
  11. * @since 100.0.2
  12. */
  13. interface FrontendInterface
  14. {
  15. /**
  16. * Test if a cache is available for the given id
  17. *
  18. * @param string $identifier Cache id
  19. * @return int|bool Last modified time of cache entry if it is available, false otherwise
  20. */
  21. public function test($identifier);
  22. /**
  23. * Load cache record by its unique identifier
  24. *
  25. * @param string $identifier
  26. * @return string|bool
  27. * @api
  28. */
  29. public function load($identifier);
  30. /**
  31. * Save cache record
  32. *
  33. * @param string $data
  34. * @param string $identifier
  35. * @param array $tags
  36. * @param int|bool|null $lifeTime
  37. * @return bool
  38. * @api
  39. */
  40. public function save($data, $identifier, array $tags = [], $lifeTime = null);
  41. /**
  42. * Remove cache record by its unique identifier
  43. *
  44. * @param string $identifier
  45. * @return bool
  46. * @api
  47. */
  48. public function remove($identifier);
  49. /**
  50. * Clean cache records matching specified tags
  51. *
  52. * @param string $mode
  53. * @param array $tags
  54. * @return bool
  55. * @api
  56. */
  57. public function clean($mode = \Zend_Cache::CLEANING_MODE_ALL, array $tags = []);
  58. /**
  59. * Retrieve backend instance
  60. *
  61. * @return \Zend_Cache_Backend_Interface
  62. */
  63. public function getBackend();
  64. /**
  65. * Retrieve frontend instance compatible with Zend Locale Data setCache() to be used as a workaround
  66. *
  67. * @return \Zend_Cache_Core
  68. */
  69. public function getLowLevelFrontend();
  70. }