PHP Class Predis\Connection\StreamConnection

The connection parameters supported by this class are:. - scheme: it can be either 'redis', 'tcp', 'rediss', 'tls' or 'unix'. - host: hostname or IP address of the server. - port: TCP port of the server. - path: path of a UNIX domain socket when scheme is 'unix'. - timeout: timeout to perform the connection (default is 5 seconds). - read_write_timeout: timeout of read / write operations. - async_connect: performs the connection asynchronously. - tcp_nodelay: enables or disables Nagle's algorithm for coalescing. - persistent: the connection is left intact after a GC collection. - ssl: context options array (see http://php.net/manual/en/context.ssl.php)
Author: Daniele Alessandri ([email protected])
Inheritance: extends AbstractConnection
Show file Open project: nrk/predis Class Usage Examples

Public Methods

Method Description
__destruct ( ) Disconnects from the server and destroys the underlying resource when the garbage collector kicks in only if the connection has not been marked as persistent.
connect ( )
disconnect ( )
read ( )
writeRequest ( Predis\Command\CommandInterface $command )

Protected Methods

Method Description
assertParameters ( Predis\Connection\ParametersInterface $parameters )
assertSslSupport ( Predis\Connection\ParametersInterface $parameters ) Checks needed conditions for SSL-encrypted connections.
createResource ( )
createStreamSocket ( Predis\Connection\ParametersInterface $parameters, string $address, integer $flags ) : resource Creates a connected stream socket resource.
tcpStreamInitializer ( Predis\Connection\ParametersInterface $parameters ) : resource Initializes a TCP stream resource.
tlsStreamInitializer ( Predis\Connection\ParametersInterface $parameters ) : resource Initializes a SSL-encrypted TCP stream resource.
unixStreamInitializer ( Predis\Connection\ParametersInterface $parameters ) : resource Initializes a UNIX stream resource.
write ( string $buffer ) Performs a write operation over the stream of the buffer containing a command serialized with the Redis wire protocol.

Method Details

__destruct() public method

Disconnects from the server and destroys the underlying resource when the garbage collector kicks in only if the connection has not been marked as persistent.
public __destruct ( )

assertParameters() protected method

protected assertParameters ( Predis\Connection\ParametersInterface $parameters )
$parameters Predis\Connection\ParametersInterface

assertSslSupport() protected method

Checks needed conditions for SSL-encrypted connections.
protected assertSslSupport ( Predis\Connection\ParametersInterface $parameters )
$parameters Predis\Connection\ParametersInterface Initialization parameters for the connection.

connect() public method

public connect ( )

createResource() protected method

protected createResource ( )

createStreamSocket() protected method

Creates a connected stream socket resource.
protected createStreamSocket ( Predis\Connection\ParametersInterface $parameters, string $address, integer $flags ) : resource
$parameters Predis\Connection\ParametersInterface Connection parameters.
$address string Address for stream_socket_client().
$flags integer Flags for stream_socket_client().
return resource

disconnect() public method

public disconnect ( )

read() public method

public read ( )

tcpStreamInitializer() protected method

Initializes a TCP stream resource.
protected tcpStreamInitializer ( Predis\Connection\ParametersInterface $parameters ) : resource
$parameters Predis\Connection\ParametersInterface Initialization parameters for the connection.
return resource

tlsStreamInitializer() protected method

Initializes a SSL-encrypted TCP stream resource.
protected tlsStreamInitializer ( Predis\Connection\ParametersInterface $parameters ) : resource
$parameters Predis\Connection\ParametersInterface Initialization parameters for the connection.
return resource

unixStreamInitializer() protected method

Initializes a UNIX stream resource.
protected unixStreamInitializer ( Predis\Connection\ParametersInterface $parameters ) : resource
$parameters Predis\Connection\ParametersInterface Initialization parameters for the connection.
return resource

write() protected method

Performs a write operation over the stream of the buffer containing a command serialized with the Redis wire protocol.
protected write ( string $buffer )
$buffer string Representation of a command in the Redis wire protocol.

writeRequest() public method

public writeRequest ( Predis\Command\CommandInterface $command )
$command Predis\Command\CommandInterface