/** * @param array|Cache $cache * * @throws LiquidException */ public function setCache($cache) { if (is_array($cache)) { if (isset($cache['cache']) && class_exists('\\Liquid\\Cache\\' . ucwords($cache['cache']))) { $classname = '\\Liquid\\Cache\\' . ucwords($cache['cache']); self::$cache = new $classname($cache); } else { throw new LiquidException('Invalid cache options!'); } } else { if ($cache instanceof Cache) { self::$cache = $cache; } } }