]> git.mxchange.org Git - friendica.git/blobdiff - src/Core/Cache/DatabaseCacheDriver.php
Merge branch 'develop' of https://github.com/friendica/friendica into develop
[friendica.git] / src / Core / Cache / DatabaseCacheDriver.php
index 58769165d148ae6b419f873b8ecbc534b740c6b0..d90c6e4f18180f6777a316dbe1cf2d70249ce85f 100644 (file)
@@ -13,6 +13,28 @@ use Friendica\Util\DateTimeFormat;
  */
 class DatabaseCacheDriver extends AbstractCacheDriver implements ICacheDriver
 {
+       /**
+        * (@inheritdoc)
+        */
+       public function getAllKeys($prefix = null)
+       {
+               if (empty($prefix)) {
+                       $where = ['`expires` >= ?', DateTimeFormat::utcNow()];
+               } else {
+                       $where = ['`expires` >= ? AND `k` LIKE CONCAT(?, \'%\')', DateTimeFormat::utcNow(), $prefix];
+               }
+
+               $stmt = DBA::select('cache', ['k'], $where);
+
+               $keys = [];
+               while ($key = DBA::fetch($stmt)) {
+                       array_push($keys, $key['k']);
+               }
+               DBA::close($stmt);
+
+               return $keys;
+       }
+
        /**
         * (@inheritdoc)
         */