]> git.mxchange.org Git - friendica.git/blobdiff - src/Core/Cache/ArrayCache.php
Log function
[friendica.git] / src / Core / Cache / ArrayCache.php
index d4fe8bc7f7084b5a925d593ab5245fc3b7eb193f..a99b05788f64e75e46d5d8e4df8c230bdcf6c414 100644 (file)
@@ -6,19 +6,27 @@ namespace Friendica\Core\Cache;
 use Friendica\Core\Cache;
 
 /**
- * @brief Implementation of the IMemoryCacheDriver mainly for testing purpose
+ * Implementation of the IMemoryCacheDriver mainly for testing purpose
  *
  * Class ArrayCache
  *
  * @package Friendica\Core\Cache
  */
-class ArrayCache implements IMemoryCacheDriver
+class ArrayCache extends AbstractCacheDriver implements IMemoryCacheDriver
 {
        use TraitCompareDelete;
 
        /** @var array Array with the cached data */
        protected $cachedData = array();
 
+       /**
+        * (@inheritdoc)
+        */
+       public function getAllKeys($prefix = null)
+       {
+               return $this->filterArrayKeysByPrefix($this->cachedData, $prefix);
+       }
+
        /**
         * (@inheritdoc)
         */
@@ -51,8 +59,13 @@ class ArrayCache implements IMemoryCacheDriver
        /**
         * (@inheritdoc)
         */
-       public function clear()
+       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 +93,4 @@ class ArrayCache implements IMemoryCacheDriver
                        return false;
                }
        }
-}
\ No newline at end of file
+}