!!! Fixed issue #10614: update the caching framework to the latest version as in...
[Packages/TYPO3.CMS.git] / t3lib / cache / frontend / interfaces / interface.t3lib_cache_frontend_frontend.php
1 <?php
2 /***************************************************************
3 * Copyright notice
4 *
5 * (c) 2009 Ingo Renner <ingo@typo3.org>
6 * All rights reserved
7 *
8 * This script is part of the TYPO3 project. The TYPO3 project is
9 * free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * The GNU General Public License can be found at
15 * http://www.gnu.org/copyleft/gpl.html.
16 * A copy is found in the textfile GPL.txt and important notices to the license
17 * from the author is found in LICENSE.txt distributed with these scripts.
18 *
19 *
20 * This script is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 * GNU General Public License for more details.
24 *
25 * This copyright notice MUST APPEAR in all copies of the script!
26 ***************************************************************/
27
28
29 /**
30 * interface for a Cache Frontend
31 *
32 * @author Ingo Renner <ingo@typo3.org>
33 * @package TYPO3
34 * @subpackage t3lib_cache
35 */
36 interface t3lib_cache_frontend_Frontend {
37
38 /**
39 * "Magic" tag for class-related entries
40 */
41 const TAG_CLASS = '%CLASS%';
42
43 /**
44 * Pattern an entry identifer must match.
45 */
46 const PATTERN_ENTRYIDENTIFIER = '/^[a-zA-Z0-9_%]{1,250}$/';
47
48 /**
49 * Pattern a tag must match.
50 */
51 const PATTERN_TAG = '/^[a-zA-Z0-9_%]{1,250}$/';
52
53 /**
54 * Returns this cache's identifier
55 *
56 * @return string The identifier for this cache
57 */
58 public function getIdentifier();
59
60 /**
61 * Returns the backend used by this cache
62 *
63 * @return t3lib_cache_backend_Backend The backend used by this cache
64 */
65 public function getBackend();
66
67 /**
68 * Saves data in the cache.
69 *
70 * @param string Something which identifies the data - depends on concrete cache
71 * @param mixed The data to cache - also depends on the concrete cache implementation
72 * @param array Tags to associate with this cache entry
73 * @return void
74 */
75 public function set($entryIdentifier, $data, $tags = array());
76
77 /**
78 * Finds and returns data from the cache.
79 *
80 * @param string Something which identifies the cache entry - depends on concrete cache
81 * @return mixed
82 */
83 public function get($entryIdentifier);
84
85 /**
86 * Finds and returns all cache entries which are tagged by the specified tag.
87 *
88 * @param string The tag to search for
89 * @return array An array with the content of all matching entries. An empty array if no entries matched
90 */
91 public function getByTag($tag);
92
93 /**
94 * Checks if a cache entry with the specified identifier exists.
95 *
96 * @param string An identifier specifying the cache entry
97 * @return boolean TRUE if such an entry exists, FALSE if not
98 */
99 public function has($entryIdentifier);
100
101 /**
102 * Removes the given cache entry from the cache.
103 *
104 * @param string An identifier specifying the cache entry
105 * @return boolean TRUE if such an entry exists, FALSE if not
106 */
107 public function remove($entryIdentifier);
108
109 /**
110 * Removes all cache entries of this cache.
111 *
112 * @return void
113 */
114 function flush();
115
116 /**
117 * Removes all cache entries of this cache which are tagged by the specified tag.
118 *
119 * @param string The tag the entries must have
120 * @return void
121 */
122 public function flushByTag($tag);
123
124 /**
125 * Removes all cache entries of this cache which are tagged by the specified tag.
126 *
127 * @param array Array of tags to search for and to remove the cache entries, the "*" wildcard is supported
128 * @return void
129 * @author Ingo Renner <ingo@typo3.org>
130 */
131 public function flushByTags(array $tags);
132
133 /**
134 * Does garbage collection
135 *
136 * @return void
137 */
138 public function collectGarbage();
139
140 /**
141 * Checks the validity of an entry identifier. Returns true if it's valid.
142 *
143 * @param string An identifier to be checked for validity
144 * @return boolean
145 */
146 public function isValidEntryIdentifier($identifier);
147
148 /**
149 * Checks the validity of a tag. Returns true if it's valid.
150 *
151 * @param string A tag to be checked for validity
152 * @return boolean
153 */
154 public function isValidTag($tag);
155
156 }
157
158
159 ?>