/** * @param string $type * @param Config $config * @return CacheInterface */ public static function create($type, Config $config) { $type = strtolower($type); $class = 'filesystem'; if ($config->isEmpty("cache.{$type}.enable") || !in_array($type, ['data', 'page'])) { $class = 'dummy'; } $class = 'Herbie\\Cache\\' . ucfirst($class) . 'Cache'; if (!class_exists($class)) { throw new \Exception("Missing cache class {$class}."); } $options = $config->get("cache.{$type}", []); return new $class($options); }