X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FCore%2FCache%2FArrayCache.php;h=01157f7f8dbd3e7167c688d30ee41f08c8c47fa3;hb=aa0b485f3dca72c5448076e913fa54d948cd7731;hp=451fec363d1d0684b5943f52bb312dedaa90803c;hpb=34e4968c060d0860f72f1d0120751e6cf8513dcb;p=friendica.git diff --git a/src/Core/Cache/ArrayCache.php b/src/Core/Cache/ArrayCache.php index 451fec363d..01157f7f8d 100644 --- a/src/Core/Cache/ArrayCache.php +++ b/src/Core/Cache/ArrayCache.php @@ -1,17 +1,32 @@ . + * + */ namespace Friendica\Core\Cache; -use Friendica\Core\Cache; +use Friendica\Core\BaseCache; /** * Implementation of the IMemoryCache mainly for testing purpose - * - * Class ArrayCache - * - * @package Friendica\Core\Cache */ -class ArrayCache extends AbstractCache implements IMemoryCache +class ArrayCache extends BaseCache implements IMemoryCache { use TraitCompareDelete; @@ -23,7 +38,7 @@ class ArrayCache extends AbstractCache implements IMemoryCache */ public function getAllKeys($prefix = null) { - return $this->filterArrayKeysByPrefix($this->cachedData, $prefix); + return $this->filterArrayKeysByPrefix(array_keys($this->cachedData), $prefix); } /** @@ -40,7 +55,7 @@ class ArrayCache extends AbstractCache implements IMemoryCache /** * (@inheritdoc) */ - public function set($key, $value, $ttl = Cache::FIVE_MINUTES) + public function set($key, $value, $ttl = Duration::FIVE_MINUTES) { $this->cachedData[$key] = $value; return true; @@ -72,7 +87,7 @@ class ArrayCache extends AbstractCache implements IMemoryCache /** * (@inheritdoc) */ - public function add($key, $value, $ttl = Cache::FIVE_MINUTES) + public function add($key, $value, $ttl = Duration::FIVE_MINUTES) { if (isset($this->cachedData[$key])) { return false; @@ -84,7 +99,7 @@ class ArrayCache extends AbstractCache implements IMemoryCache /** * (@inheritdoc) */ - public function compareSet($key, $oldValue, $newValue, $ttl = Cache::FIVE_MINUTES) + public function compareSet($key, $oldValue, $newValue, $ttl = Duration::FIVE_MINUTES) { if ($this->get($key) === $oldValue) { return $this->set($key, $newValue); @@ -93,8 +108,11 @@ class ArrayCache extends AbstractCache implements IMemoryCache } } - public function __toString() + /** + * {@inheritDoc} + */ + public function getName() { - return self::TYPE_ARRAY; + return Type::ARRAY; } }