]> git.mxchange.org Git - friendica.git/blob - src/Core/Cache/ICacheDriver.php
Add new Cache console command
[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          * @return array|null Null if it isn't supported by the cache driver
18          */
19         public function getAllKeys();
20
21         /**
22          * Fetches cached data according to the key
23          *
24          * @param string $key The key to the cached data
25          *
26          * @return mixed Cached $value or "null" if not found
27          */
28         public function get($key);
29
30         /**
31          * Stores data in the cache identified by the key. The input $value can have multiple formats.
32          *
33          * @param string  $key      The cache key
34          * @param mixed   $value    The value to store
35          * @param integer $ttl The cache lifespan, must be one of the Cache constants
36          *
37          * @return bool
38          */
39         public function set($key, $value, $ttl = Cache::FIVE_MINUTES);
40
41         /**
42          * Delete a key from the cache
43          *
44          * @param string $key      The cache key
45          *
46          * @return bool
47          */
48         public function delete($key);
49
50         /**
51          * Remove outdated data from the cache
52          * @param  boolean $outdated just remove outdated values
53          *
54          * @return bool
55          */
56         public function clear($outdated = true);
57 }