]> git.mxchange.org Git - friendica.git/blob - src/Core/Cache/ICacheDriver.php
Merge branch 'master' into develop
[friendica.git] / src / Core / Cache / ICacheDriver.php
1 <?php\r
2 \r
3 namespace Friendica\Core\Cache;\r
4 \r
5 use Friendica\Core\Cache;\r
6 \r
7 /**\r
8  * Cache Driver Interface\r
9  *\r
10  * @author Hypolite Petovan <mrpetovan@gmail.com>\r
11  */\r
12 interface ICacheDriver\r
13 {\r
14         /**\r
15          * Fetches cached data according to the key\r
16          *\r
17          * @param string $key The key to the cached data\r
18          *\r
19          * @return mixed Cached $value or "null" if not found\r
20          */\r
21         public function get($key);\r
22 \r
23         /**\r
24          * Stores data in the cache identified by the key. The input $value can have multiple formats.\r
25          *\r
26          * @param string  $key      The cache key\r
27          * @param mixed   $value    The value to store\r
28          * @param integer $duration The cache lifespan, must be one of the Cache constants\r
29          *\r
30          * @return bool\r
31          */\r
32         public function set($key, $value, $duration = Cache::MONTH);\r
33 \r
34 \r
35         /**\r
36          * Delete a key from the cache\r
37          *\r
38          * @param string $key\r
39          *\r
40          * @return bool\r
41          */\r
42         public function delete($key);\r
43 \r
44         /**\r
45          * Remove outdated data from the cache\r
46          *\r
47          * @return bool\r
48          */\r
49         public function clear();\r
50 }\r