Updated the caching framework to the according FLOW3 revision 2616
[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 * @param integer Lifetime of this cache entry in seconds. If NULL is specified, the default lifetime is used. "0" means unlimited liftime.
74 * @return void
75 */
76 public function set($entryIdentifier, $data, $tags = array(), $lifetime = NULL);
77
78 /**
79 * Finds and returns data from the cache.
80 *
81 * @param string Something which identifies the cache entry - depends on concrete cache
82 * @return mixed
83 */
84 public function get($entryIdentifier);
85
86 /**
87 * Finds and returns all cache entries which are tagged by the specified tag.
88 *
89 * @param string The tag to search for
90 * @return array An array with the content of all matching entries. An empty array if no entries matched
91 */
92 public function getByTag($tag);
93
94 /**
95 * Checks if a cache entry with the specified identifier exists.
96 *
97 * @param string An identifier specifying the cache entry
98 * @return boolean TRUE if such an entry exists, FALSE if not
99 */
100 public function has($entryIdentifier);
101
102 /**
103 * Removes the given cache entry from the cache.
104 *
105 * @param string An identifier specifying the cache entry
106 * @return boolean TRUE if such an entry exists, FALSE if not
107 * @internal
108 */
109 public function remove($entryIdentifier);
110
111 /**
112 * Removes all cache entries of this cache.
113 *
114 * @return void
115 */
116 function flush();
117
118 /**
119 * Removes all cache entries of this cache which are tagged by the specified tag.
120 *
121 * @param string The tag the entries must have
122 * @return void
123 */
124 public function flushByTag($tag);
125
126 /**
127 * Removes all cache entries of this cache which are tagged by the specified tag.
128 *
129 * @param array Array of tags to search for and to remove the cache entries, the "*" wildcard is supported
130 * @return void
131 * @author Ingo Renner <ingo@typo3.org>
132 */
133 public function flushByTags(array $tags);
134
135 /**
136 * Does garbage collection
137 *
138 * @return void
139 */
140 public function collectGarbage();
141
142 /**
143 * Checks the validity of an entry identifier. Returns true if it's valid.
144 *
145 * @param string An identifier to be checked for validity
146 * @return boolean
147 */
148 public function isValidEntryIdentifier($identifier);
149
150 /**
151 * Checks the validity of a tag. Returns true if it's valid.
152 *
153 * @param string A tag to be checked for validity
154 * @return boolean
155 */
156 public function isValidTag($tag);
157
158 }
159
160
161 ?>