/** * Disable a server * * If a server doesn't respond we want to disable it. * * If you have APC enabled then we'll set a disabled flag there for * APC_TTL_DISABLE_SERVER seconds. We don't store the flag in APC forever * because we don't want to clear APC on your client/web-server in order to * unset that flag in the event the server has come back up. * * Either way - we store the flag in a local cache as well * * @param string|array $hostAndPort localhost:80 * or array('host' => localhost, 'port' => 80) * * @return void */ public static function disableServer($hostAndPort) { Resqee_Config_Jobs::getInstance(); if (is_array($hostAndPort)) { $hostAndPort = "{$hostAndPort['host']}:{$hostAndPort['port']}"; } self::$disabledServers[$hostAndPort] = true; if (Resqee::isAPCEnabled()) { apc_add(self::APC_KEY_SERVER_DISABLED . $hostAndPort, true, self::APC_TTL_DISABLE_SERVER); } }