src/Fasim/Cache/simulate/Memcached.php
protected function connect()
    {
        $rs = false;

        foreach ((array)$this->server as $svr) {
            $error = 0;
            $errstr = '';
            $rs = @fsockopen($svr['host'], $svr['port'], $error, $errstr);

            if ($rs) {
                $this->socket = $rs;

            } else {
                $key = $this->getServerKey(
                    $svr['host'],
                    $svr['port'],
                    $svr['weight']
                );
                $s = "Connect to $key error:" . PHP_EOL .
                    "    [$error] $errstr";
                error_log($s);
            }
        }

        if (is_null($this->socket)) {
            $this->resultCode = Memcached::RES_FAILURE;
            $this->resultMessage = 'No server avaliable.';
            return false;

        } else {
            $this->resultCode = Memcached::RES_SUCCESS;
            $this->resultMessage = '';
            return true;
        }
    }
protected function connect()
    {
        $rs = false;

        foreach ((array)$this->server as $svr) {
            $error = 0;
            $errstr = '';
            $rs = @fsockopen($svr['host'], $svr['port'], $error, $errstr);

            if ($rs) {
                $this->socket = $rs;

            } else {
                $key = $this->getServerKey(
                    $svr['host'],
                    $svr['port'],
                    $svr['weight']
                );
                $s = "Connect to $key error:" . PHP_EOL .
                    "    [$error] $errstr";
                error_log($s);
            }
        }

        if (is_null($this->socket)) {
            $this->resultCode = Memcached::RES_FAILURE;
            $this->resultMessage = 'No server avaliable.';
            return false;

        } else {
            $this->resultCode = Memcached::RES_SUCCESS;
            $this->resultMessage = '';
            return true;
        }
    }
protected function connect ( ) { $ rs = false ; foreach ( ( array ) $ this -> server as $ svr ) { $ error = 0 ; $ errstr = '' ; $ rs = @ fsockopen ( $ svr [ 'host' ] , $ svr [ 'port' ] , $ error , $ errstr ) ; if ( $ rs ) { $ this -> socket = $ rs ; } else { $ key = $ this -> getServerKey ( $ svr [ 'host' ] , $ svr [ 'port' ] , $ svr [ 'weight' ] ) ; $ s = "Connect to $key error:" . PHP_EOL . "    [$error] $errstr" ; error_log ( $ s ) ; } } if ( is_null ( $ this -> socket ) ) { $ this -> resultCode = Memcached :: RES_FAILURE ; $ this -> resultMessage = 'No server avaliable.' ; return false ; } else { $ this -> resultCode = Memcached :: RES_SUCCESS ; $ this -> resultMessage = '' ; return true ; } }
Connect to memcached server

@return  boolean
Connect to memcached server