3 namespace Friendica\Core\Cache;
4 use Friendica\Core\Cache;
7 * This interface defines methods for Memory-Caches only
9 * Interface IMemoryCacheDriver
11 * @package Friendica\Core\Cache
13 interface IMemoryCacheDriver extends ICacheDriver
16 * Sets a value if it's not already stored
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
23 public function add($key, $value, $ttl = Cache::FIVE_MINUTES);
26 * Compares if the old value is set and sets the new value
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
35 public function compareSet($key, $oldValue, $newValue, $ttl = Cache::FIVE_MINUTES);
38 * Compares if the old value is set and removes it
40 * @param string $key The cache key
41 * @param mixed $value The old value we know and want to delete
44 public function compareDelete($key, $value);