[TASK] Re-work/simplify copyright header in PHP files - Part 2
[Packages/TYPO3.CMS.git] / typo3 / sysext / core / Classes / Cache / Backend / BackendInterface.php
1 <?php
2 namespace TYPO3\CMS\Core\Cache\Backend;
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 * A contract for a Cache Backend
18 *
19 * @author Ingo Renner <ingo@typo3.org>
20 * @api
21 */
22 interface BackendInterface
23 {
24 /**
25 * Sets a reference to the cache frontend which uses this backend
26 *
27 * @param \TYPO3\CMS\Core\Cache\Frontend\FrontendInterface $cache The frontend for this backend
28 * @return void
29 * @api
30 */
31 public function setCache(\TYPO3\CMS\Core\Cache\Frontend\FrontendInterface $cache);
32
33 /**
34 * Saves data in the cache.
35 *
36 * @param string $entryIdentifier An identifier for this specific cache entry
37 * @param string $data The data to be stored
38 * @param array $tags Tags to associate with this cache entry. If the backend does not support tags, this option can be ignored.
39 * @param integer $lifetime Lifetime of this cache entry in seconds. If NULL is specified, the default lifetime is used. "0" means unlimited lifetime.
40 * @return void
41 * @throws \TYPO3\CMS\Core\Cache\Exception if no cache frontend has been set.
42 * @throws \TYPO3\CMS\Core\Cache\Exception\InvalidDataException if the data is not a string
43 * @api
44 */
45 public function set($entryIdentifier, $data, array $tags = array(), $lifetime = NULL);
46
47 /**
48 * Loads data from the cache.
49 *
50 * @param string $entryIdentifier An identifier which describes the cache entry to load
51 * @return mixed The cache entry's content as a string or FALSE if the cache entry could not be loaded
52 * @api
53 */
54 public function get($entryIdentifier);
55
56 /**
57 * Checks if a cache entry with the specified identifier exists.
58 *
59 * @param string $entryIdentifier An identifier specifying the cache entry
60 * @return boolean TRUE if such an entry exists, FALSE if not
61 * @api
62 */
63 public function has($entryIdentifier);
64
65 /**
66 * Removes all cache entries matching the specified identifier.
67 * Usually this only affects one entry but if - for what reason ever -
68 * old entries for the identifier still exist, they are removed as well.
69 *
70 * @param string $entryIdentifier Specifies the cache entry to remove
71 * @return boolean TRUE if (at least) an entry could be removed or FALSE if no entry was found
72 * @api
73 */
74 public function remove($entryIdentifier);
75
76 /**
77 * Removes all cache entries of this cache.
78 *
79 * @return void
80 * @api
81 */
82 public function flush();
83
84 /**
85 * Does garbage collection
86 *
87 * @return void
88 * @api
89 */
90 public function collectGarbage();
91
92 }