]> git.mxchange.org Git - friendica.git/blob - src/Core/Cache/ICacheDriver.php
Update install to generate config/local.config.php
[friendica.git] / src / Core / Cache / ICacheDriver.php
1 <?php
2
3 namespace Friendica\Core\Cache;
4
5 use Friendica\Core\Cache;
6
7 /**
8  * Cache Driver Interface
9  *
10  * @author Hypolite Petovan <hypolite@mrpetovan.com>
11  */
12 interface ICacheDriver
13 {
14         /**
15          * Lists all cache keys
16          *
17          * @param string prefix optional a prefix to search
18          *
19          * @return array Empty if it isn't supported by the cache driver
20          */
21         public function getAllKeys($prefix = null);
22
23         /**
24          * Fetches cached data according to the key
25          *
26          * @param string $key The key to the cached data
27          *
28          * @return mixed Cached $value or "null" if not found
29          */
30         public function get($key);
31
32         /**
33          * Stores data in the cache identified by the key. The input $value can have multiple formats.
34          *
35          * @param string  $key      The cache key
36          * @param mixed   $value    The value to store
37          * @param integer $ttl      The cache lifespan, must be one of the Cache constants
38          *
39          * @return bool
40          */
41         public function set($key, $value, $ttl = Cache::FIVE_MINUTES);
42
43         /**
44          * Delete a key from the cache
45          *
46          * @param string $key      The cache key
47          *
48          * @return bool
49          */
50         public function delete($key);
51
52         /**
53          * Remove outdated data from the cache
54          * @param  boolean $outdated just remove outdated values
55          *
56          * @return bool
57          */
58         public function clear($outdated = true);
59 }