]> git.mxchange.org Git - friendica.git/blob - src/Core/Cache/IMemoryCacheDriver.php
Adding multihost - locking
[friendica.git] / src / Core / Cache / IMemoryCacheDriver.php
1 <?php
2
3 namespace Friendica\Core\Cache;
4 use Friendica\Core\Cache;
5
6 /**
7  * @brief This interface defines methods for Memory-Caches only
8  *
9  * Interface IMemoryCacheDriver
10  *
11  * @package Friendica\Core\Cache
12  */
13 interface IMemoryCacheDriver extends ICacheDriver
14 {
15         /**
16          * @brief Sets a value if it's not already stored
17          *
18          * @param string $key      The cache key
19          * @param mixed  $value    The old value we know from the cache
20          * @param int    $ttl      The cache lifespan, must be one of the Cache constants
21          * @return bool
22          */
23         public function add($key, $value, $ttl = Cache::FIVE_MINUTES);
24
25         /**
26          * @brief Compares if the old value is set and sets the new value
27          *
28          * @param string $key         The cache key
29          * @param mixed  $oldValue    The old value we know from the cache
30          * @param mixed  $newValue    The new value we want to set
31          * @param int    $ttl              The cache lifespan, must be one of the Cache constants
32          *
33          * @return bool
34          */
35         public function compareSet($key, $oldValue, $newValue, $ttl = Cache::FIVE_MINUTES);
36
37         /**
38          * @brief Compares if the old value is set and removes it
39          *
40          * @param string $key          The cache key
41          * @param mixed  $value        The old value we know and want to delete
42          * @return bool
43          */
44         public function compareDelete($key, $value);
45 }