]> git.mxchange.org Git - friendica.git/blob - src/Core/Cache/ICacheDriver.php
Adding multihost - locking
[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 <mrpetovan@gmail.com>
11  */
12 interface ICacheDriver
13 {
14         /**
15          * @brief 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          * @brief 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          * @brief 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          * @brief Remove outdated data from the cache
45          *
46          * @return bool
47          */
48         public function clear();
49 }