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.
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 * @version $Id: Interface.php 16541 2009-07-07 06:59:03Z bkarwin $
26 * @subpackage Zend_Cache_Backend
27 * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
28 * @license http://framework.zend.com/license/new-bsd New BSD License
30 interface Zend_Cache_Backend_Interface
33 * Set the frontend directives
35 * @param array $directives assoc of directives
37 public function setDirectives($directives);
40 * Test if a cache is available for the given id and (if yes) return it (false else)
42 * Note : return value is always "string" (unserialization is done by the core not by the backend)
44 * @param string $id Cache id
45 * @param boolean $doNotTestCacheValidity If set to true, the cache validity won't be tested
46 * @return string|false cached datas
48 public function load($id, $doNotTestCacheValidity = false);
51 * Test if a cache is available or not (for the given id)
53 * @param string $id cache id
54 * @return mixed|false (a cache is not available) or "last modified" timestamp (int) of the available cache record
56 public function test($id);
59 * Save some string datas into a cache record
61 * Note : $data is always "string" (serialization is done by the
62 * core not by the backend)
64 * @param string $data Datas to cache
65 * @param string $id Cache id
66 * @param array $tags Array of strings, the cache record will be tagged by each string entry
67 * @param int $specificLifetime If != false, set a specific lifetime for this cache record (null => infinite lifetime)
68 * @return boolean true if no problem
70 public function save($data, $id, $tags = array(), $specificLifetime = false);
73 * Remove a cache record
75 * @param string $id Cache id
76 * @return boolean True if no problem
78 public function remove($id);
81 * Clean some cache records
83 * Available modes are :
84 * Zend_Cache::CLEANING_MODE_ALL (default) => remove all cache entries ($tags is not used)
85 * Zend_Cache::CLEANING_MODE_OLD => remove too old cache entries ($tags is not used)
86 * Zend_Cache::CLEANING_MODE_MATCHING_TAG => remove cache entries matching all given tags
87 * ($tags can be an array of strings or a single string)
88 * Zend_Cache::CLEANING_MODE_NOT_MATCHING_TAG => remove cache entries not {matching one of the given tags}
89 * ($tags can be an array of strings or a single string)
90 * Zend_Cache::CLEANING_MODE_MATCHING_ANY_TAG => remove cache entries matching any given tags
91 * ($tags can be an array of strings or a single string)
93 * @param string $mode Clean mode
94 * @param array $tags Array of tags
95 * @return boolean true if no problem
97 public function clean($mode = Zend_Cache
::CLEANING_MODE_ALL
, $tags = array());