]> git.mxchange.org Git - friendica.git/blob - src/Core/Cache/ICache.php
Merge pull request #7754 from annando/aria
[friendica.git] / src / Core / Cache / ICache.php
1 <?php
2
3 namespace Friendica\Core\Cache;
4
5 /**
6  * Cache Interface
7  *
8  * @author Hypolite Petovan <hypolite@mrpetovan.com>
9  */
10 interface ICache
11 {
12         /**
13          * Lists all cache keys
14          *
15          * @param string prefix optional a prefix to search
16          *
17          * @return array Empty if it isn't supported by the cache driver
18          */
19         public function getAllKeys($prefix = null);
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
58         /**
59          * Returns the name of the current cache
60          *
61          * @return string
62          */
63         public function getName();
64 }