66 $connectionTimeout = $this->
getConfig()[
'connectionTimeout'] ?? 1;
67 $serializer = $this->
getConfig()[
'serializer'] ?? \Memcached::SERIALIZER_PHP;
69 $connection = new \Memcached();
70 $connection->setOption(\Memcached::OPT_CONNECT_TIMEOUT, $connectionTimeout);
71 $connection->setOption(\Memcached::OPT_SERIALIZER, $serializer);
74 if (!empty($this->servers))
76 foreach ($this->servers as $server)
78 $success = $connection->addServer(
90 $error = error_get_last();
91 if (isset($error[
'type']) && $error[
'type'] === E_WARNING)
93 $exception = new \ErrorException($error[
'message'], 0, $error[
'type'], $error[
'file'], $error[
'line']);
95 $exceptionHandler = $application->getExceptionHandler();
96 $exceptionHandler->writeToLog($exception);
100 return $result? $connection :
null;