]> git.mxchange.org Git - friendica.git/blobdiff - src/Core/Cache.php
Move Cache::clear() to DI::cache()->clear()
[friendica.git] / src / Core / Cache.php
index 7a952ff8a14a8149875bada999f778676adca4d2..3e8a3f00475656a6c560e32a8cc1d5398cf11f53 100644 (file)
@@ -4,14 +4,13 @@
  */
 namespace Friendica\Core;
 
-use Friendica\BaseObject;
 use Friendica\Core\Cache\Cache as CacheClass;
-use Friendica\Core\Cache\ICache;
+use Friendica\DI;
 
 /**
  * @brief Class for storing data for a short time
  */
-class Cache extends BaseObject
+class Cache
 {
        /** @deprecated Use CacheClass::MONTH */
        const MONTH        = CacheClass::MONTH;
@@ -32,19 +31,6 @@ class Cache extends BaseObject
        /** @deprecated Use CacheClass::INFINITE */
        const INFINITE     = CacheClass::INFINITE;
 
-       /**
-        * @brief Returns all the cache keys sorted alphabetically
-        *
-        * @param string $prefix Prefix of the keys (optional)
-        *
-        * @return array Empty if the driver doesn't support this feature
-        * @throws \Exception
-        */
-       public static function getAllKeys($prefix = null)
-       {
-               return self::getClass(ICache::class)->getAllKeys($prefix);
-       }
-
        /**
         * @brief Fetch cached data according to the key
         *
@@ -55,7 +41,7 @@ class Cache extends BaseObject
         */
        public static function get($key)
        {
-               return self::getClass(ICache::class)->get($key);
+               return DI::cache()->get($key);
        }
 
        /**
@@ -72,7 +58,7 @@ class Cache extends BaseObject
         */
        public static function set($key, $value, $duration = CacheClass::MONTH)
        {
-               return self::getClass(ICache::class)->set($key, $value, $duration);
+               return DI::cache()->set($key, $value, $duration);
        }
 
        /**
@@ -85,19 +71,6 @@ class Cache extends BaseObject
         */
        public static function delete($key)
        {
-               return self::getClass(ICache::class)->delete($key);
-       }
-
-       /**
-        * @brief Remove outdated data from the cache
-        *
-        * @param boolean $outdated just remove outdated values
-        *
-        * @return bool
-        * @throws \Exception
-        */
-       public static function clear($outdated = true)
-       {
-               return self::getClass(ICache::class)->clear($outdated);
+               return DI::cache()->delete($key);
        }
 }