namespace Friendica\Core\Cache;
-
-use Friendica\Core\Cache;
-
/**
- * Implementation of the IMemoryCacheDriver mainly for testing purpose
+ * Implementation of the IMemoryCache mainly for testing purpose
*
* Class ArrayCache
*
* @package Friendica\Core\Cache
*/
-class ArrayCache extends AbstractCacheDriver implements IMemoryCacheDriver
+class ArrayCache extends Cache implements IMemoryCache
{
use TraitCompareDelete;
/** @var array Array with the cached data */
protected $cachedData = array();
+ /**
+ * (@inheritdoc)
+ */
+ public function getAllKeys($prefix = null)
+ {
+ return $this->filterArrayKeysByPrefix(array_keys($this->cachedData), $prefix);
+ }
+
/**
* (@inheritdoc)
*/
*/
public function clear($outdated = true)
{
+ // Array doesn't support TTL so just don't delete something
+ if ($outdated) {
+ return true;
+ }
+
$this->cachedData = [];
return true;
}
return false;
}
}
+
+ /**
+ * {@inheritDoc}
+ */
+ public function getName()
+ {
+ return self::TYPE_ARRAY;
+ }
}