/** * Function to connect to the memcache server. We will go ahead and get our * server IP address from our serverArray and port from portArray. * * If failure to connecting to server, it will try next sever in the array. * * If pcon is set to true, it will then open up a pressitent connection. * * If server is supllied it will connect with that server. We Will check to * see if the server is an IP or index value for the serverArray. * * @param int[optional] $server * @param bool[optional] $pCon */ function memConnect($server = null, $pCon = null) { if($this->memCache) { if($server) { if(is_numeric($server)) { // index from serverArray $server = $this->serverArray[$server]; $port = null; } else { // use custom IP , we will do an // explode to see if there is a port $serverData = explode(':', $server); $server = $serverData[0]; $port = (empty($serverData[1]) ? '11211' : $serverData[1]); } $memcon = @$this->memCache->connect($server, $port); if($memcon) { return array(1, 1); } else { $this->p_error(0, 'There was an error while trying to connect to the memcache server IP:' . $server . ' Port:' . $port); return array(0, 'Error with connection to memcache server'); } } else { // ok grab one from the serverArray } } else { // memcache object was not created in the constructor } }