PHP Class Nexcessnet_Turpentine_Model_Varnish_Admin_Socket

ファイルを表示 Open project: nexcess/magento-turpentine Class Usage Examples

Protected Properties

Property Type Description
$_VERSIONS VCL config versions, should match config select values
$_authSecret
$_host
$_port
$_private
$_timeout
$_varnishConn resource Varnish socket connection
$_version

Public Methods

Method Description
__call ( string $name, array $args ) : array Provide simple Varnish methods
__construct ( array $options = [] ) auto-detect
getConnectionString ( ) : string Get the connection string for this socket (:)
getHost ( ) : string Get the set host for this instance
getPort ( ) : integer Get the port set for this instance
getVersion ( ) : string Find out what version mode we're running in
isConnected ( ) : boolean Check if we're connected to Varnish
quit ( ) Stop the Varnish instance
setAuthSecret ( string $authSecret = null ) Set the Varnish admin auth secret, use null to indicate there isn't one
setHost ( string $host ) Set the Varnish host name/ip to connect to
setPort ( integer $port ) Set the Varnish admin port
setTimeout ( integer $timeout ) Set the timeout to connect to the varnish instance
setVersion ( string $version ) Explicitly set the version of the varnish instance we're connecting to
start ( ) Start running the Varnish child
status ( ) : boolean Check if Varnish has a child running or not
stop ( ) Stop the running child (if it is running)

Protected Methods

Method Description
_close ( ) Close the connection (if we're connected)
_command ( string $verb, integer $okCode = 200 ) : array [_command description]
_connect ( ) : boolean Establish a connection to the configured Varnish instance
_determineVersion ( string $bannerText )
_read ( ) : array Read a response from Varnish instance
_translateCommandMethod ( string $verb ) : string Handle v2.1 <> v3.0 command compatibility
_write ( string $data ) Write data to the Varnish instance, a newline is automatically appended

Method Details

__call() public method

Methods provided: help [command] ping [timestamp] auth response banner stats vcl.load vcl.inline vcl.use vcl.discard vcl.list vcl.show param.show [-l] [] param.set purge.url purge [&& ]... purge.list
public __call ( string $name, array $args ) : array
$name string method name
$args array method args
return array

__construct() public method

auto-detect
public __construct ( array $options = [] )
$options array

_close() protected method

Close the connection (if we're connected)
protected _close ( )

_command() protected method

[_command description]
protected _command ( string $verb, integer $okCode = 200 ) : array
$verb string command name
$okCode integer code that indicates command was successful
return array

_connect() protected method

Establish a connection to the configured Varnish instance
protected _connect ( ) : boolean
return boolean

_determineVersion() protected method

protected _determineVersion ( string $bannerText )
$bannerText string

_read() protected method

Read a response from Varnish instance
protected _read ( ) : array
return array tuple of the response (code, text)

_translateCommandMethod() protected method

Handle v2.1 <> v3.0 command compatibility
protected _translateCommandMethod ( string $verb ) : string
$verb string command to check
return string

_write() protected method

Write data to the Varnish instance, a newline is automatically appended
protected _write ( string $data )
$data string data to write

getConnectionString() public method

Get the connection string for this socket (:)
public getConnectionString ( ) : string
return string

getHost() public method

Get the set host for this instance
public getHost ( ) : string
return string

getPort() public method

Get the port set for this instance
public getPort ( ) : integer
return integer

getVersion() public method

Find out what version mode we're running in
public getVersion ( ) : string
return string

isConnected() public method

Check if we're connected to Varnish
public isConnected ( ) : boolean
return boolean

quit() public method

Stop the Varnish instance
public quit ( )

setAuthSecret() public method

Set the Varnish admin auth secret, use null to indicate there isn't one
public setAuthSecret ( string $authSecret = null )
$authSecret string

setHost() public method

Set the Varnish host name/ip to connect to
public setHost ( string $host )
$host string hostname or ip

setPort() public method

Set the Varnish admin port
public setPort ( integer $port )
$port integer

setTimeout() public method

Set the timeout to connect to the varnish instance
public setTimeout ( integer $timeout )
$timeout integer

setVersion() public method

Explicitly set the version of the varnish instance we're connecting to
public setVersion ( string $version )
$version string version from $_VERSIONS

start() public method

Start running the Varnish child
public start ( )

status() public method

Check if Varnish has a child running or not
public status ( ) : boolean
return boolean

stop() public method

Stop the running child (if it is running)
public stop ( )

Property Details

$_VERSIONS protected_oe static_oe property

VCL config versions, should match config select values
protected static $_VERSIONS

$_authSecret protected_oe property

protected $_authSecret

$_host protected_oe property

protected $_host

$_port protected_oe property

protected $_port

$_private protected_oe property

protected $_private

$_timeout protected_oe property

protected $_timeout

$_varnishConn protected_oe property

Varnish socket connection
protected resource $_varnishConn
return resource

$_version protected_oe property

protected $_version