Documentation

MasterSlaveReplication
in package
implements ReplicationInterface

Aggregate connection handling replication of Redis nodes configured in a single master / multiple slaves setup.

Tags
author

Daniele Alessandri suppakilla@gmail.com

Interfaces, Classes and Traits

ReplicationInterface
Defines a group of Redis nodes in a master / slave replication setup.

Table of Contents

$autoDiscovery  : bool
$connectionFactory  : FactoryInterface
$current  : NodeConnectionInterface
$master  : NodeConnectionInterface
$slaves  : array<string|int, NodeConnectionInterface>
$strategy  : ReplicationStrategy
__construct()  : mixed
{@inheritdoc}
__sleep()  : mixed
{@inheritdoc}
add()  : mixed
{@inheritdoc}
connect()  : mixed
{@inheritdoc}
disconnect()  : mixed
{@inheritdoc}
discover()  : mixed
Fetches the replication configuration from one of the servers.
executeCommand()  : mixed
{@inheritdoc}
getConnection()  : mixed
{@inheritdoc}
getConnectionById()  : mixed
{@inheritdoc}
getCurrent()  : NodeConnectionInterface
Returns the connection instance currently in use by the aggregate connection.
getMaster()  : NodeConnectionInterface
Returns the connection instance for the master Redis node.
getReplicationStrategy()  : ReplicationStrategy
Returns the underlying replication strategy.
getSlaves()  : NodeConnectionInterface
Returns a list of connection instances to slave nodes.
isConnected()  : mixed
{@inheritdoc}
readResponse()  : mixed
{@inheritdoc}
remove()  : mixed
{@inheritdoc}
setAutoDiscovery()  : mixed
Configures the automatic discovery of the replication configuration on failure.
setConnectionFactory()  : mixed
Sets the connection factory used to create the connections by the auto discovery procedure.
switchTo()  : mixed
Switches the internal connection instance in use.
switchToMaster()  : mixed
Switches to the master server.
switchToSlave()  : mixed
Switches to a random slave server.
writeRequest()  : mixed
{@inheritdoc}
discoverFromMaster()  : mixed
Discovers the replication configuration by contacting the master node.
discoverFromSlave()  : mixed
Discovers the replication configuration by contacting one of the slaves.
pickSlave()  : NodeConnectionInterface
Returns a random slave.
reset()  : mixed
Resets the connection state.
getMasterOrDie()  : NodeConnectionInterface
Returns the connection associated to the master server.
handleInfoResponse()  : array<string|int, mixed>
Handles response from INFO.
retryCommandOnFailure()  : mixed
Retries the execution of a command upon slave failure.

Properties

Methods

discover()

Fetches the replication configuration from one of the servers.

public discover() : mixed
Return values
mixed

getConnectionById()

{@inheritdoc}

public getConnectionById(mixed $connectionId) : mixed
Parameters
$connectionId : mixed
Return values
mixed

setAutoDiscovery()

Configures the automatic discovery of the replication configuration on failure.

public setAutoDiscovery(bool $value) : mixed
Parameters
$value : bool

Enable or disable auto discovery.

Return values
mixed

setConnectionFactory()

Sets the connection factory used to create the connections by the auto discovery procedure.

public setConnectionFactory(FactoryInterface $connectionFactory) : mixed
Parameters
$connectionFactory : FactoryInterface

Connection factory instance.

Return values
mixed

switchTo()

Switches the internal connection instance in use.

public switchTo(mixed $connection) : mixed
Parameters
$connection : mixed

Alias of a connection

Return values
mixed

switchToMaster()

Switches to the master server.

public switchToMaster() : mixed
Return values
mixed

switchToSlave()

Switches to a random slave server.

public switchToSlave() : mixed
Return values
mixed

handleInfoResponse()

Handles response from INFO.

private handleInfoResponse(string $response) : array<string|int, mixed>
Parameters
$response : string
Return values
array<string|int, mixed>

retryCommandOnFailure()

Retries the execution of a command upon slave failure.

private retryCommandOnFailure(CommandInterface $command, string $method) : mixed
Parameters
$command : CommandInterface

Command instance.

$method : string

Actual method.

Return values
mixed

Search results