class Connection

Redis connection.

Properties

protected resource $connection Connection.
protected string|null $name Connection name.
protected bool $isPersistent Is the connection persistent?
protected int $connectionTimeout Connection timeout.
protected int $readWriteTimeout Read/write timeout.
protected bool $tcpNodelay TCP nodelay.

Methods

__construct(string $host, int $port = 6379, array $options = [])

Constructor.

__destruct()

Destructor.

array
getOptions()

Returns the connection options.

resource
createConnection(string $host, int $port)

Creates a connection to the server.

string
appendReadErrorReason(string $message)

Appends the read error reason to the error message if possible.

string
readLine()

Gets line from the server.

string
read(int $bytes)

Reads n bytes from the server.

int
write(string $data)

Writes data to the server.

Details

at line 83
__construct(string $host, int $port = 6379, array $options = [])

Constructor.

Parameters

string $host Redis host
int $port Redis port
array $options Connection options

at line 105
__destruct()

Destructor.

at line 118
array getOptions()

Returns the connection options.

Return Value

array

at line 137
protected resource createConnection(string $host, int $port)

Creates a connection to the server.

Parameters

string $host Redis host
int $port Redis port

Return Value

resource

at line 168
protected string appendReadErrorReason(string $message)

Appends the read error reason to the error message if possible.

Parameters

string $message Error message

Return Value

string

at line 183
string readLine()

Gets line from the server.

Return Value

string

at line 201
string read(int $bytes)

Reads n bytes from the server.

Parameters

int $bytes Number of bytes to read

Return Value

string

at line 231
int write(string $data)

Writes data to the server.

Parameters

string $data Data to write

Return Value

int