app/code/community/Nexcessnet/Turpentine/Model/Varnish/Admin/Socket.php
protected function _write($data) {
        if (is_null($this->_varnishConn)) {
            $this->_connect();
        }
        $data = rtrim($data).PHP_EOL;
        $dataLength = strlen($data);
        if ($dataLength >= self::CLI_CMD_LENGTH_LIMIT) {
            $cliBufferResponse = $this->param_show('cli_buffer');
            $regexp = '~^cli_buffer\s+(\d+)\s+\[bytes\]~';
            if ($this->getVersion() === '4.0' || $this->getVersion() === '4.1') {
                // Varnish4 supports "16k" style notation
                $regexp = '~^cli_buffer\s+Value is:\s+(\d+)([k|m|g|b]{1})?\s+\[bytes\]~';
            }
            if (preg_match($regexp, $cliBufferResponse['text'], $match)) {
                $realLimit = (int) $match[1];
                if (isset($match[2])) {
                    $factors = array('b'=>0, 'k'=>1, 'm'=>2, 'g'=>3);
                    $realLimit *= pow(1024, $factors[$match[2]]);
                }
            } else {
                Mage::helper('turpentine/debug')->logWarn(
                    'Failed to determine Varnish cli_buffer limit, using default' );
                $realLimit = self::CLI_CMD_LENGTH_LIMIT;
            }
            if ($dataLength >= $realLimit) {
                Mage::throwException(sprintf(
                    'Varnish data to write over length limit by %d characters',
                    $dataLength - $realLimit ));
            }
        }
        if (($byteCount = fwrite($this->_varnishConn, $data)) !== $dataLength) {
            Mage::throwException(sprintf('Varnish socket write error: %d != %d',
                $byteCount, $dataLength));
        }
        return $this;
    }
protected function _write($data) {
        if (is_null($this->_varnishConn)) {
            $this->_connect();
        }
        $data = rtrim($data).PHP_EOL;
        $dataLength = strlen($data);
        if ($dataLength >= self::CLI_CMD_LENGTH_LIMIT) {
            $cliBufferResponse = $this->param_show('cli_buffer');
            $regexp = '~^cli_buffer\s+(\d+)\s+\[bytes\]~';
            if ($this->getVersion() === '4.0' || $this->getVersion() === '4.1') {
                // Varnish4 supports "16k" style notation
                $regexp = '~^cli_buffer\s+Value is:\s+(\d+)([k|m|g|b]{1})?\s+\[bytes\]~';
            }
            if (preg_match($regexp, $cliBufferResponse['text'], $match)) {
                $realLimit = (int) $match[1];
                if (isset($match[2])) {
                    $factors = array('b'=>0, 'k'=>1, 'm'=>2, 'g'=>3);
                    $realLimit *= pow(1024, $factors[$match[2]]);
                }
            } else {
                Mage::helper('turpentine/debug')->logWarn(
                    'Failed to determine Varnish cli_buffer limit, using default' );
                $realLimit = self::CLI_CMD_LENGTH_LIMIT;
            }
            if ($dataLength >= $realLimit) {
                Mage::throwException(sprintf(
                    'Varnish data to write over length limit by %d characters',
                    $dataLength - $realLimit ));
            }
        }
        if (($byteCount = fwrite($this->_varnishConn, $data)) !== $dataLength) {
            Mage::throwException(sprintf('Varnish socket write error: %d != %d',
                $byteCount, $dataLength));
        }
        return $this;
    }
protected function _write ( $ data ) { if ( is_null ( $ this -> _varnishConn ) ) { $ this -> _connect ( ) ; } $ data = rtrim ( $ data ) . PHP_EOL ; $ dataLength = strlen ( $ data ) ; if ( $ dataLength >= self :: CLI_CMD_LENGTH_LIMIT ) { $ cliBufferResponse = $ this -> param_show ( 'cli_buffer' ) ; $ regexp = '~^cli_buffer\s+(\d+)\s+\[bytes\]~' ; if ( $ this -> getVersion ( ) === '4.0' || $ this -> getVersion ( ) === '4.1' ) { // Varnish4 supports "16k" style notation $ regexp = '~^cli_buffer\s+Value is:\s+(\d+)([k|m|g|b]{1})?\s+\[bytes\]~' ; } if ( preg_match ( $ regexp , $ cliBufferResponse [ 'text' ] , $ match ) ) { $ realLimit = ( int ) $ match [ 1 ] ; if ( isset ( $ match [ 2 ] ) ) { $ factors = array ( 'b' => 0 , 'k' => 1 , 'm' => 2 , 'g' => 3 ) ; $ realLimit *= pow ( 1024 , $ factors [ $ match [ 2 ] ] ) ; } } else { Mage :: helper ( 'turpentine/debug' ) -> logWarn ( 'Failed to determine Varnish cli_buffer limit, using default' ) ; $ realLimit = self :: CLI_CMD_LENGTH_LIMIT ; } if ( $ dataLength >= $ realLimit ) { Mage :: throwException ( sprintf ( 'Varnish data to write over length limit by %d characters' , $ dataLength - $ realLimit ) ) ; } } if ( ( $ byteCount = fwrite ( $ this -> _varnishConn , $ data ) ) !== $ dataLength ) { Mage :: throwException ( sprintf ( 'Varnish socket write error: %d != %d' , $ byteCount , $ dataLength ) ) ; } return $ this ; }
Write data to the Varnish instance, a newline is automatically appended

@param  string $data data to write
@return $this
Write data to the Varnish instance a newline is automatically appended