Interface.php 3.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. <?php
  2. /**
  3. * Zend Framework
  4. *
  5. * LICENSE
  6. *
  7. * This source file is subject to the new BSD license that is bundled
  8. * with this package in the file LICENSE.txt.
  9. * It is also available through the world-wide-web at this URL:
  10. * http://framework.zend.com/license/new-bsd
  11. * If you did not receive a copy of the license and are unable to
  12. * obtain it through the world-wide-web, please send an email
  13. * to license@zend.com so we can send you a copy immediately.
  14. *
  15. * @category Zend
  16. * @package Zend_Cache
  17. * @subpackage Zend_Cache_Backend
  18. * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
  19. * @license http://framework.zend.com/license/new-bsd New BSD License
  20. */
  21. /**
  22. * @package Zend_Cache
  23. * @subpackage Zend_Cache_Backend
  24. * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
  25. * @license http://framework.zend.com/license/new-bsd New BSD License
  26. */
  27. interface Zend_Cache_Backend_Interface
  28. {
  29. /**
  30. * Set the frontend directives
  31. *
  32. * @param array $directives assoc of directives
  33. */
  34. public function setDirectives($directives);
  35. /**
  36. * Test if a cache is available for the given id and (if yes) return it (false else)
  37. *
  38. * Note : return value is always "string" (unserialization is done by the core not by the backend)
  39. *
  40. * @param string $id Cache id
  41. * @param boolean $doNotTestCacheValidity If set to true, the cache validity won't be tested
  42. * @return string|false cached datas
  43. */
  44. public function load($id, $doNotTestCacheValidity = false);
  45. /**
  46. * Test if a cache is available or not (for the given id)
  47. *
  48. * @param string $id cache id
  49. * @return mixed|false (a cache is not available) or "last modified" timestamp (int) of the available cache record
  50. */
  51. public function test($id);
  52. /**
  53. * Save some string datas into a cache record
  54. *
  55. * Note : $data is always "string" (serialization is done by the
  56. * core not by the backend)
  57. *
  58. * @param string $data Datas to cache
  59. * @param string $id Cache id
  60. * @param array $tags Array of strings, the cache record will be tagged by each string entry
  61. * @param int $specificLifetime If != false, set a specific lifetime for this cache record (null => infinite lifetime)
  62. * @return boolean true if no problem
  63. */
  64. public function save($data, $id, $tags = array(), $specificLifetime = false);
  65. /**
  66. * Remove a cache record
  67. *
  68. * @param string $id Cache id
  69. * @return boolean True if no problem
  70. */
  71. public function remove($id);
  72. /**
  73. * Clean some cache records
  74. *
  75. * Available modes are :
  76. * Zend_Cache::CLEANING_MODE_ALL (default) => remove all cache entries ($tags is not used)
  77. * Zend_Cache::CLEANING_MODE_OLD => remove too old cache entries ($tags is not used)
  78. * Zend_Cache::CLEANING_MODE_MATCHING_TAG => remove cache entries matching all given tags
  79. * ($tags can be an array of strings or a single string)
  80. * Zend_Cache::CLEANING_MODE_NOT_MATCHING_TAG => remove cache entries not {matching one of the given tags}
  81. * ($tags can be an array of strings or a single string)
  82. * Zend_Cache::CLEANING_MODE_MATCHING_ANY_TAG => remove cache entries matching any given tags
  83. * ($tags can be an array of strings or a single string)
  84. *
  85. * @param string $mode Clean mode
  86. * @param array $tags Array of tags
  87. * @return boolean true if no problem
  88. */
  89. public function clean($mode = Zend_Cache::CLEANING_MODE_ALL, $tags = array());
  90. }