scratch – Blame information for rev 117
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
115 | office | 1 | <?php |
2 | /* |
||
3 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
||
4 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
||
5 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
||
6 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
||
7 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
||
8 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
||
9 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
||
10 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
||
11 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
||
12 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
||
13 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
||
14 | * |
||
15 | * This software consists of voluntary contributions made by many individuals |
||
16 | * and is licensed under the MIT license. For more information, see |
||
17 | * <http://www.doctrine-project.org>. |
||
18 | */ |
||
19 | |||
20 | namespace Doctrine\Common\Cache; |
||
21 | |||
22 | /** |
||
23 | * Interface for cache drivers. |
||
24 | * |
||
25 | * @link www.doctrine-project.org |
||
26 | * @since 2.0 |
||
27 | * @author Benjamin Eberlei <kontakt@beberlei.de> |
||
28 | * @author Guilherme Blanco <guilhermeblanco@hotmail.com> |
||
29 | * @author Jonathan Wage <jonwage@gmail.com> |
||
30 | * @author Roman Borschel <roman@code-factory.org> |
||
31 | * @author Fabio B. Silva <fabio.bat.silva@gmail.com> |
||
32 | * @author Kévin Dunglas <dunglas@gmail.com> |
||
33 | */ |
||
34 | interface Cache |
||
35 | { |
||
36 | const STATS_HITS = 'hits'; |
||
37 | const STATS_MISSES = 'misses'; |
||
38 | const STATS_UPTIME = 'uptime'; |
||
39 | const STATS_MEMORY_USAGE = 'memory_usage'; |
||
40 | const STATS_MEMORY_AVAILABLE = 'memory_available'; |
||
41 | /** |
||
42 | * Only for backward compatibility (may be removed in next major release) |
||
43 | * |
||
44 | * @deprecated |
||
45 | */ |
||
46 | const STATS_MEMORY_AVAILIABLE = 'memory_available'; |
||
47 | |||
48 | /** |
||
49 | * Fetches an entry from the cache. |
||
50 | * |
||
51 | * @param string $id The id of the cache entry to fetch. |
||
52 | * |
||
53 | * @return mixed The cached data or FALSE, if no cache entry exists for the given id. |
||
54 | */ |
||
55 | public function fetch($id); |
||
56 | |||
57 | /** |
||
58 | * Tests if an entry exists in the cache. |
||
59 | * |
||
60 | * @param string $id The cache id of the entry to check for. |
||
61 | * |
||
62 | * @return bool TRUE if a cache entry exists for the given cache id, FALSE otherwise. |
||
63 | */ |
||
64 | public function contains($id); |
||
65 | |||
66 | /** |
||
67 | * Puts data into the cache. |
||
68 | * |
||
69 | * If a cache entry with the given id already exists, its data will be replaced. |
||
70 | * |
||
71 | * @param string $id The cache id. |
||
72 | * @param mixed $data The cache entry/data. |
||
73 | * @param int $lifeTime The lifetime in number of seconds for this cache entry. |
||
74 | * If zero (the default), the entry never expires (although it may be deleted from the cache |
||
75 | * to make place for other entries). |
||
76 | * |
||
77 | * @return bool TRUE if the entry was successfully stored in the cache, FALSE otherwise. |
||
78 | */ |
||
79 | public function save($id, $data, $lifeTime = 0); |
||
80 | |||
81 | /** |
||
82 | * Deletes a cache entry. |
||
83 | * |
||
84 | * @param string $id The cache id. |
||
85 | * |
||
86 | * @return bool TRUE if the cache entry was successfully deleted, FALSE otherwise. |
||
87 | * Deleting a non-existing entry is considered successful. |
||
88 | */ |
||
89 | public function delete($id); |
||
90 | |||
91 | /** |
||
92 | * Retrieves cached information from the data store. |
||
93 | * |
||
94 | * The server's statistics array has the following values: |
||
95 | * |
||
96 | * - <b>hits</b> |
||
97 | * Number of keys that have been requested and found present. |
||
98 | * |
||
99 | * - <b>misses</b> |
||
100 | * Number of items that have been requested and not found. |
||
101 | * |
||
102 | * - <b>uptime</b> |
||
103 | * Time that the server is running. |
||
104 | * |
||
105 | * - <b>memory_usage</b> |
||
106 | * Memory used by this server to store items. |
||
107 | * |
||
108 | * - <b>memory_available</b> |
||
109 | * Memory allowed to use for storage. |
||
110 | * |
||
111 | * @since 2.2 |
||
112 | * |
||
113 | * @return array|null An associative array with server's statistics if available, NULL otherwise. |
||
114 | */ |
||
115 | public function getStats(); |
||
116 | } |