[TASK] Re-work/simplify copyright header in PHP files - Part 2
[Packages/TYPO3.CMS.git] / typo3 / sysext / core / Classes / Cache / Frontend / FrontendInterface.php
1 <?php
2 namespace TYPO3\CMS\Core\Cache\Frontend;
3
4 /**
5 * This file is part of the TYPO3 CMS project.
6 *
7 * It is free software; you can redistribute it and/or modify it under
8 * the terms of the GNU General Public License, either version 2
9 * of the License, or any later version.
10 *
11 * For the full copyright and license information, please read the
12 * LICENSE.txt file that was distributed with this source code.
13 *
14 * The TYPO3 project - inspiring people to share!
15 */
16 /**
17 * Contract for a Cache (frontend)
18 *
19 * @author Ingo Renner <ingo@typo3.org>
20 * @api
21 */
22 interface FrontendInterface
23 {
24 /**
25 * "Magic" tag for class-related entries
26 */
27 const TAG_CLASS = '%CLASS%';
28 /**
29 * "Magic" tag for package-related entries
30 */
31 const TAG_PACKAGE = '%PACKAGE%';
32 /**
33 * Pattern an entry identifer must match.
34 */
35 const PATTERN_ENTRYIDENTIFIER = '/^[a-zA-Z0-9_%\\-&]{1,250}$/';
36 /**
37 * Pattern a tag must match.
38 */
39 const PATTERN_TAG = '/^[a-zA-Z0-9_%\\-&]{1,250}$/';
40 /**
41 * Returns this cache's identifier
42 *
43 * @return string The identifier for this cache
44 * @api
45 */
46 public function getIdentifier();
47
48 /**
49 * Returns the backend used by this cache
50 *
51 * @return \TYPO3\CMS\Core\Cache\Backend\BackendInterface The backend used by this cache
52 */
53 public function getBackend();
54
55 /**
56 * Saves data in the cache.
57 *
58 * @param string $entryIdentifier Something which identifies the data - depends on concrete cache
59 * @param mixed $data The data to cache - also depends on the concrete cache implementation
60 * @param array $tags Tags to associate with this cache entry
61 * @param integer $lifetime Lifetime of this cache entry in seconds. If NULL is specified, the default lifetime is used. "0" means unlimited liftime.
62 * @return void
63 * @api
64 */
65 public function set($entryIdentifier, $data, array $tags = array(), $lifetime = NULL);
66
67 /**
68 * Finds and returns data from the cache.
69 *
70 * @param string $entryIdentifier Something which identifies the cache entry - depends on concrete cache
71 * @return mixed
72 * @api
73 */
74 public function get($entryIdentifier);
75
76 /**
77 * Finds and returns all cache entries which are tagged by the specified tag.
78 *
79 * @param string $tag The tag to search for
80 * @return array An array with the content of all matching entries. An empty array if no entries matched
81 * @api
82 */
83 public function getByTag($tag);
84
85 /**
86 * Checks if a cache entry with the specified identifier exists.
87 *
88 * @param string $entryIdentifier An identifier specifying the cache entry
89 * @return boolean TRUE if such an entry exists, FALSE if not
90 * @api
91 */
92 public function has($entryIdentifier);
93
94 /**
95 * Removes the given cache entry from the cache.
96 *
97 * @param string $entryIdentifier An identifier specifying the cache entry
98 * @return boolean TRUE if such an entry exists, FALSE if not
99 */
100 public function remove($entryIdentifier);
101
102 /**
103 * Removes all cache entries of this cache.
104 *
105 * @return void
106 */
107 public function flush();
108
109 /**
110 * Removes all cache entries of this cache which are tagged by the specified tag.
111 *
112 * @param string $tag The tag the entries must have
113 * @return void
114 * @api
115 */
116 public function flushByTag($tag);
117
118 /**
119 * Does garbage collection
120 *
121 * @return void
122 * @api
123 */
124 public function collectGarbage();
125
126 /**
127 * Checks the validity of an entry identifier. Returns TRUE if it's valid.
128 *
129 * @param string $identifier An identifier to be checked for validity
130 * @return boolean
131 * @api
132 */
133 public function isValidEntryIdentifier($identifier);
134
135 /**
136 * Checks the validity of a tag. Returns TRUE if it's valid.
137 *
138 * @param string $tag A tag to be checked for validity
139 * @return boolean
140 * @api
141 */
142 public function isValidTag($tag);
143
144 }