3 namespace Friendica\Core\Cache;
6 * This interface defines methods for Memory-Caches only
8 * Interface IMemoryCache
10 * @package Friendica\Core\Cache
12 interface IMemoryCache extends ICache
15 * Sets a value if it's not already stored
17 * @param string $key The cache key
18 * @param mixed $value The old value we know from the cache
19 * @param int $ttl The cache lifespan, must be one of the Cache constants
22 public function add($key, $value, $ttl = ICache::FIVE_MINUTES);
25 * Compares if the old value is set and sets the new value
27 * @param string $key The cache key
28 * @param mixed $oldValue The old value we know from the cache
29 * @param mixed $newValue The new value we want to set
30 * @param int $ttl The cache lifespan, must be one of the Cache constants
34 public function compareSet($key, $oldValue, $newValue, $ttl = ICache::FIVE_MINUTES);
37 * Compares if the old value is set and removes it
39 * @param string $key The cache key
40 * @param mixed $value The old value we know and want to delete
43 public function compareDelete($key, $value);