68 $connectionTimeout = $this->
getConfig()[
'connectionTimeout'] ?? 1;
69 $connection = new \Memcache();
72 if (count($this->servers) === 1)
74 [
'host' => $host,
'port' => $port] = $this->servers[0];
75 $result = $connection->pconnect($host, $port, $connectionTimeout);
79 foreach ($this->servers as $server)
81 $success = $connection->addServer(
98 $error = error_get_last();
99 if (isset($error[
"type"]) && $error[
"type"] === E_WARNING)
101 $exception = new \ErrorException($error[
'message'], 0, $error[
'type'], $error[
'file'], $error[
'line']);
103 $exceptionHandler = $application->getExceptionHandler();
104 $exceptionHandler->writeToLog($exception);
108 return $result? $connection :
null;