Documentation

Connection
in package

A connection to a beanstalkd server.

Tags
author

Paul Annesley

license

http://www.opensource.org/licenses/mit-license.php

Table of Contents

CRLF  = " "
CRLF_LENGTH  = 2
DEFAULT_CONNECT_TIMEOUT  = 2
$_connectPersistent  : mixed
$_connectTimeout  : mixed
$_dataResponses  : mixed
$_errorResponses  : mixed
$_hostname  : mixed
$_port  : mixed
$_socket  : mixed
__construct()  : mixed
disconnect()  : mixed
Disconnect the socket.
dispatchCommand()  : object
getConnectTimeout()  : float
Returns the connect timeout for this connection.
getHost()  : string
Returns the host for this connection.
getPort()  : int
Returns the port for this connection.
hasSocket()  : bool
isServiceListening()  : true|false
Checks connection to the beanstalkd socket.
setSocket()  : $this
Sets a manually created socket, used for unit testing.
_getSocket()  : Socket
Socket handle for the connection to beanstalkd.

Constants

DEFAULT_CONNECT_TIMEOUT

public mixed DEFAULT_CONNECT_TIMEOUT = 2

Properties

$_connectPersistent

private mixed $_connectPersistent

$_dataResponses

private static mixed $_dataResponses = array(PheanstalkResponse::RESPONSE_RESERVED, PheanstalkResponse::RESPONSE_FOUND, PheanstalkResponse::RESPONSE_OK)

$_errorResponses

private static mixed $_errorResponses = array(PheanstalkResponse::RESPONSE_OUT_OF_MEMORY => 'OutOfMemory', PheanstalkResponse::RESPONSE_INTERNAL_ERROR => 'InternalError', PheanstalkResponse::RESPONSE_DRAINING => 'Draining', PheanstalkResponse::RESPONSE_BAD_FORMAT => 'BadFormat', PheanstalkResponse::RESPONSE_UNKNOWN_COMMAND => 'UnknownCommand')

Methods

__construct()

public __construct(string $hostname, int $port[, float $connectTimeout = null ][, bool $connectPersistent = false ]) : mixed
Parameters
$hostname : string
$port : int
$connectTimeout : float = null
$connectPersistent : bool = false
Return values
mixed

disconnect()

Disconnect the socket.

public disconnect() : mixed

Subsequent socket operations will create a new connection.

Return values
mixed

dispatchCommand()

public dispatchCommand(object $command) : object
Parameters
$command : object

Command

Tags
throws
ClientException
Return values
object

Response

getConnectTimeout()

Returns the connect timeout for this connection.

public getConnectTimeout() : float
Return values
float

getHost()

Returns the host for this connection.

public getHost() : string
Return values
string

getPort()

Returns the port for this connection.

public getPort() : int
Return values
int

hasSocket()

public hasSocket() : bool
Return values
bool

isServiceListening()

Checks connection to the beanstalkd socket.

public isServiceListening() : true|false
Return values
true|false

setSocket()

Sets a manually created socket, used for unit testing.

public setSocket(Socket $socket) : $this
Parameters
$socket : Socket
Return values
$this

Search results