flushAll(); self::getTransientCache()->flushAll(); self::getEagerCache()->flushAll(); } /** * @param $type * @return \Matomo\Cache\Backend */ public static function buildBackend($type) { $factory = new \Matomo\Cache\Backend\Factory(); $options = self::getOptions($type); $backend = $factory->buildBackend($type, $options); return $backend; } private static function getOptions($type) { $options = self::getBackendOptions($type); switch ($type) { case 'file': $options = array('directory' => StaticContainer::get('path.cache')); break; case 'chained': foreach ($options['backends'] as $backend) { $options[$backend] = self::getOptions($backend); } break; case 'redis': if (!empty($options['timeout'])) { $options['timeout'] = (float)Common::forceDotAsSeparatorForDecimalPoint($options['timeout']); } break; } return $options; } private static function getBackendOptions($backend) { $key = ucfirst($backend) . 'Cache'; $options = Config::getInstance()->$key; return $options; } }