TYPO3 API  SVNRelease
interface.t3lib_cache_frontend_frontend.php
Go to the documentation of this file.
00001 <?php
00002 /***************************************************************
00003  *  Copyright notice
00004  *
00005  *  (c) 2009-2011 Ingo Renner <ingo@typo3.org>
00006  *  All rights reserved
00007  *
00008  *  This script is part of the TYPO3 project. The TYPO3 project is
00009  *  free software; you can redistribute it and/or modify
00010  *  it under the terms of the GNU General Public License as published by
00011  *  the Free Software Foundation; either version 2 of the License, or
00012  *  (at your option) any later version.
00013  *
00014  *  The GNU General Public License can be found at
00015  *  http://www.gnu.org/copyleft/gpl.html.
00016  *  A copy is found in the textfile GPL.txt and important notices to the license
00017  *  from the author is found in LICENSE.txt distributed with these scripts.
00018  *
00019  *
00020  *  This script is distributed in the hope that it will be useful,
00021  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00022  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00023  *  GNU General Public License for more details.
00024  *
00025  *  This copyright notice MUST APPEAR in all copies of the script!
00026  ***************************************************************/
00027 
00028 
00029 /**
00030  * interface for a Cache Frontend
00031  *
00032  * @author  Ingo Renner <ingo@typo3.org>
00033  * @package TYPO3
00034  * @api
00035  * @subpackage t3lib_cache
00036  */
00037 interface t3lib_cache_frontend_Frontend {
00038 
00039     /**
00040      * "Magic" tag for class-related entries
00041      */
00042     const TAG_CLASS = '%CLASS%';
00043 
00044     /**
00045      * Pattern an entry identifer must match.
00046      */
00047     const PATTERN_ENTRYIDENTIFIER = '/^[a-zA-Z0-9_%\-&]{1,250}$/';
00048 
00049     /**
00050      * Pattern a tag must match.
00051      */
00052     const PATTERN_TAG = '/^[a-zA-Z0-9_%\-&]{1,250}$/';
00053 
00054     /**
00055      * Returns this cache's identifier
00056      *
00057      * @return string The identifier for this cache
00058      */
00059     public function getIdentifier();
00060 
00061     /**
00062      * Returns the backend used by this cache
00063      *
00064      * @return t3lib_cache_backend_Backend The backend used by this cache
00065      */
00066     public function getBackend();
00067 
00068     /**
00069      * Saves data in the cache.
00070      *
00071      * @param   string  Something which identifies the data - depends on concrete cache
00072      * @param   mixed   The data to cache - also depends on the concrete cache implementation
00073      * @param   array   Tags to associate with this cache entry
00074      * @param   integer Lifetime of this cache entry in seconds. If NULL is specified, the default lifetime is used. "0" means unlimited liftime.
00075      * @return  void
00076      */
00077     public function set($entryIdentifier, $data, $tags = array(), $lifetime = NULL);
00078 
00079     /**
00080      * Finds and returns data from the cache.
00081      *
00082      * @param   string  Something which identifies the cache entry - depends on concrete cache
00083      * @return  mixed
00084      */
00085     public function get($entryIdentifier);
00086 
00087     /**
00088      * Finds and returns all cache entries which are tagged by the specified tag.
00089      *
00090      * @param   string  The tag to search for
00091      * @return  array   An array with the content of all matching entries. An empty array if no entries matched
00092      */
00093     public function getByTag($tag);
00094 
00095     /**
00096      * Checks if a cache entry with the specified identifier exists.
00097      *
00098      * @param   string  An identifier specifying the cache entry
00099      * @return  boolean TRUE if such an entry exists, FALSE if not
00100      */
00101     public function has($entryIdentifier);
00102 
00103     /**
00104      * Removes the given cache entry from the cache.
00105      *
00106      * @param   string  An identifier specifying the cache entry
00107      * @return  boolean TRUE if such an entry exists, FALSE if not
00108      * @internal
00109      */
00110     public function remove($entryIdentifier);
00111 
00112     /**
00113      * Removes all cache entries of this cache.
00114      *
00115      * @return  void
00116      */
00117     function flush();
00118 
00119     /**
00120      * Removes all cache entries of this cache which are tagged by the specified tag.
00121      *
00122      * @param   string  The tag the entries must have
00123      * @return  void
00124      */
00125     public function flushByTag($tag);
00126 
00127     /**
00128      * Removes all cache entries of this cache which are tagged by the specified tag.
00129      *
00130      * @param   array   Array of tags to search for and to remove the cache entries, the "*" wildcard is supported
00131      * @return  void
00132      * @author Ingo Renner <ingo@typo3.org>
00133      */
00134     public function flushByTags(array $tags);
00135 
00136     /**
00137      * Does garbage collection
00138      *
00139      * @return  void
00140      */
00141     public function collectGarbage();
00142 
00143     /**
00144      * Checks the validity of an entry identifier. Returns true if it's valid.
00145      *
00146      * @param string $identifier An identifier to be checked for validity
00147      * @return boolean
00148      */
00149     public function isValidEntryIdentifier($identifier);
00150 
00151     /**
00152      * Checks the validity of a tag. Returns true if it's valid.
00153      *
00154      * @param string $tag A tag to be checked for validity
00155      * @return boolean
00156      */
00157     public function isValidTag($tag);
00158 
00159 }
00160 
00161 
00162 ?>