File indexing completed on 2024-06-16 05:29:53

0001 <?php
0002 /**
0003  * Zend Framework
0004  *
0005  * LICENSE
0006  *
0007  * This source file is subject to the new BSD license that is bundled
0008  * with this package in the file LICENSE.txt.
0009  * It is also available through the world-wide-web at this URL:
0010  * http://framework.zend.com/license/new-bsd
0011  * If you did not receive a copy of the license and are unable to
0012  * obtain it through the world-wide-web, please send an email
0013  * to license@zend.com so we can send you a copy immediately.
0014  *
0015  * @category   Zend
0016  * @package    Zend_Cache
0017  * @subpackage Zend_Cache_Backend
0018  * @copyright  Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
0019  * @license    http://framework.zend.com/license/new-bsd     New BSD License
0020  * @version    $Id$
0021  */
0022 
0023 
0024 /**
0025  * @package    Zend_Cache
0026  * @subpackage Zend_Cache_Backend
0027  * @copyright  Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
0028  * @license    http://framework.zend.com/license/new-bsd     New BSD License
0029  */
0030 interface Zend_Cache_Backend_Interface
0031 {
0032     /**
0033      * Set the frontend directives
0034      *
0035      * @param array $directives assoc of directives
0036      */
0037     public function setDirectives($directives);
0038 
0039     /**
0040      * Test if a cache is available for the given id and (if yes) return it (false else)
0041      *
0042      * Note : return value is always "string" (unserialization is done by the core not by the backend)
0043      *
0044      * @param  string  $id                     Cache id
0045      * @param  boolean $doNotTestCacheValidity If set to true, the cache validity won't be tested
0046      * @return string|false cached datas
0047      */
0048     public function load($id, $doNotTestCacheValidity = false);
0049 
0050     /**
0051      * Test if a cache is available or not (for the given id)
0052      *
0053      * @param  string $id cache id
0054      * @return mixed|false (a cache is not available) or "last modified" timestamp (int) of the available cache record
0055      */
0056     public function test($id);
0057 
0058     /**
0059      * Save some string datas into a cache record
0060      *
0061      * Note : $data is always "string" (serialization is done by the
0062      * core not by the backend)
0063      *
0064      * @param  string $data            Datas to cache
0065      * @param  string $id              Cache id
0066      * @param  array $tags             Array of strings, the cache record will be tagged by each string entry
0067      * @param  int   $specificLifetime If != false, set a specific lifetime for this cache record (null => infinite lifetime)
0068      * @return boolean true if no problem
0069      */
0070     public function save($data, $id, $tags = array(), $specificLifetime = false);
0071 
0072     /**
0073      * Remove a cache record
0074      *
0075      * @param  string $id Cache id
0076      * @return boolean True if no problem
0077      */
0078     public function remove($id);
0079 
0080     /**
0081      * Clean some cache records
0082      *
0083      * Available modes are :
0084      * Zend_Cache::CLEANING_MODE_ALL (default)    => remove all cache entries ($tags is not used)
0085      * Zend_Cache::CLEANING_MODE_OLD              => remove too old cache entries ($tags is not used)
0086      * Zend_Cache::CLEANING_MODE_MATCHING_TAG     => remove cache entries matching all given tags
0087      *                                               ($tags can be an array of strings or a single string)
0088      * Zend_Cache::CLEANING_MODE_NOT_MATCHING_TAG => remove cache entries not {matching one of the given tags}
0089      *                                               ($tags can be an array of strings or a single string)
0090      * Zend_Cache::CLEANING_MODE_MATCHING_ANY_TAG => remove cache entries matching any given tags
0091      *                                               ($tags can be an array of strings or a single string)
0092      *
0093      * @param  string $mode Clean mode
0094      * @param  array  $tags Array of tags
0095      * @return boolean true if no problem
0096      */
0097     public function clean($mode = Zend_Cache::CLEANING_MODE_ALL, $tags = array());
0098 
0099 }