set(1); try { LightCache::set('stop', 'OK'); } catch (Exception $e) { } server()->shutdown(); server()->stop(); } public static function reload($delay = 800) { Console::info(Console::setColor("Reloading server...", "gold")); usleep($delay * 1000); foreach ((LightCacheInside::get("wait_api", "wait_api") ?? []) as $k => $v) { if (($v["result"] ?? false) === null && isset($v["coroutine"])) Co::resume($v["coroutine"]); } LightCacheInside::unset("wait_api", "wait_api"); LightCache::savePersistence(); //DataProvider::saveBuffer(); Timer::clearAll(); server()->reload(); } public static function getModInstance($class) { if (!isset(ZMBuf::$instance[$class])) { //Console::debug("Class instance $class not exist, so I created it."); return ZMBuf::$instance[$class] = new $class(); } else { return ZMBuf::$instance[$class]; } } }