]> git.mxchange.org Git - friendica.git/blob - src/Core/Cache/ICacheDriver.php
Merge pull request #5765 from MrPetovan/bug/php7-remove-pear-text_highlighter
[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          * Fetches cached data according to the key
16          *
17          * @param string $key The key to the cached data
18          *
19          * @return mixed Cached $value or "null" if not found
20          */
21         public function get($key);
22
23         /**
24          * Stores data in the cache identified by the key. The input $value can have multiple formats.
25          *
26          * @param string  $key      The cache key
27          * @param mixed   $value    The value to store
28          * @param integer $ttl The cache lifespan, must be one of the Cache constants
29          *
30          * @return bool
31          */
32         public function set($key, $value, $ttl = Cache::FIVE_MINUTES);
33
34         /**
35          * Delete a key from the cache
36          *
37          * @param string $key      The cache key
38          *
39          * @return bool
40          */
41         public function delete($key);
42
43         /**
44          * Remove outdated data from the cache
45          * @param  boolean $outdated just remove outdated values
46          *
47          * @return bool
48          */
49         public function clear($outdated = true);
50 }