*/
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;
/** @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
*
*/
public static function get($key)
{
- return self::getClass(ICache::class)->get($key);
+ return DI::cache()->get($key);
}
/**
*/
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);
}
/**
*/
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);
}
}