web/lib/Zend/Cache/Backend/Interface.php
changeset 64 162c1de6545a
parent 19 1c2f13fd785c
child 68 ecaf28ffe26e
equal deleted inserted replaced
63:5b37998e522e 64:162c1de6545a
       
     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-2010 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 20096 2010-01-06 02:05:09Z bkarwin $
       
    21  */
       
    22 
       
    23 
       
    24 /**
       
    25  * @package    Zend_Cache
       
    26  * @subpackage Zend_Cache_Backend
       
    27  * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
       
    28  * @license    http://framework.zend.com/license/new-bsd     New BSD License
       
    29  */
       
    30 interface Zend_Cache_Backend_Interface
       
    31 {
       
    32     /**
       
    33      * Set the frontend directives
       
    34      *
       
    35      * @param array $directives assoc of directives
       
    36      */
       
    37     public function setDirectives($directives);
       
    38 
       
    39     /**
       
    40      * Test if a cache is available for the given id and (if yes) return it (false else)
       
    41      *
       
    42      * Note : return value is always "string" (unserialization is done by the core not by the backend)
       
    43      *
       
    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
       
    47      */
       
    48     public function load($id, $doNotTestCacheValidity = false);
       
    49 
       
    50     /**
       
    51      * Test if a cache is available or not (for the given id)
       
    52      *
       
    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
       
    55      */
       
    56     public function test($id);
       
    57 
       
    58     /**
       
    59      * Save some string datas into a cache record
       
    60      *
       
    61      * Note : $data is always "string" (serialization is done by the
       
    62      * core not by the backend)
       
    63      *
       
    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
       
    69      */
       
    70     public function save($data, $id, $tags = array(), $specificLifetime = false);
       
    71 
       
    72     /**
       
    73      * Remove a cache record
       
    74      *
       
    75      * @param  string $id Cache id
       
    76      * @return boolean True if no problem
       
    77      */
       
    78     public function remove($id);
       
    79 
       
    80     /**
       
    81      * Clean some cache records
       
    82      *
       
    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)
       
    92      *
       
    93      * @param  string $mode Clean mode
       
    94      * @param  array  $tags Array of tags
       
    95      * @return boolean true if no problem
       
    96      */
       
    97     public function clean($mode = Zend_Cache::CLEANING_MODE_ALL, $tags = array());
       
    98 
       
    99 }