X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FCore%2FCache%2FArrayCache.php;h=c6f3983ee2586efed12aeed3a8db4d516ccef3f7;hb=cbe435bb708ccf17a4b5bea1e20c3258c9524700;hp=b1982871487c241830dea1d70e5eb6a0750cd2ac;hpb=80a4e6263fd53f83a710d2a2e6c57baae38cb14b;p=friendica.git diff --git a/src/Core/Cache/ArrayCache.php b/src/Core/Cache/ArrayCache.php index b198287148..c6f3983ee2 100644 --- a/src/Core/Cache/ArrayCache.php +++ b/src/Core/Cache/ArrayCache.php @@ -2,23 +2,28 @@ 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) */ @@ -53,6 +58,11 @@ class ArrayCache extends AbstractCacheDriver implements IMemoryCacheDriver */ public function clear($outdated = true) { + // Array doesn't support TTL so just don't delete something + if ($outdated) { + return true; + } + $this->cachedData = []; return true; } @@ -80,4 +90,12 @@ class ArrayCache extends AbstractCacheDriver implements IMemoryCacheDriver return false; } } + + /** + * {@inheritDoc} + */ + public function getName() + { + return self::TYPE_ARRAY; + } }