PHP Class Predis\Connection\Aggregate\MasterSlaveReplication

Author: Daniele Alessandri ([email protected])
Inheritance: implements Predis\Connection\Aggregate\ReplicationInterface
Afficher le fichier Open project: tillkruss/redis-object-cache Class Usage Examples

Protected Properties

Свойство Type Description
$autoDiscovery boolean
$connectionFactory Predis\Connection\FactoryInterface
$current Predis\Connection\NodeConnectionInterface
$master Predis\Connection\NodeConnectionInterface
$slaves Predis\Connection\NodeConnectionInterface[]
$strategy Predis\Replication\ReplicationStrategy

Méthodes publiques

Méthode Description
__construct ( ReplicationStrategy $strategy = null )
__sleep ( )
add ( Predis\Connection\NodeConnectionInterface $connection )
connect ( )
disconnect ( )
discover ( ) Fetches the replication configuration from one of the servers.
executeCommand ( Predis\Command\CommandInterface $command )
getConnection ( Predis\Command\CommandInterface $command )
getConnectionById ( $connectionId )
getCurrent ( )
getMaster ( )
getReplicationStrategy ( ) : ReplicationStrategy Returns the underlying replication strategy.
getSlaves ( )
isConnected ( )
readResponse ( Predis\Command\CommandInterface $command )
remove ( Predis\Connection\NodeConnectionInterface $connection )
setAutoDiscovery ( boolean $value ) Configures the automatic discovery of the replication configuration on failure.
setConnectionFactory ( Predis\Connection\FactoryInterface $connectionFactory ) Sets the connection factory used to create the connections by the auto discovery procedure.
switchTo ( $connection )
switchToMaster ( ) Switches to the master server.
switchToSlave ( ) Switches to a random slave server.
writeRequest ( Predis\Command\CommandInterface $command )

Méthodes protégées

Méthode Description
discoverFromMaster ( Predis\Connection\NodeConnectionInterface $connection, Predis\Connection\FactoryInterface $connectionFactory ) Discovers the replication configuration by contacting the master node.
discoverFromSlave ( Predis\Connection\NodeConnectionInterface $connection, Predis\Connection\FactoryInterface $connectionFactory ) Discovers the replication configuration by contacting one of the slaves.
pickSlave ( ) : Predis\Connection\NodeConnectionInterface Returns a random slave.
reset ( ) Resets the connection state.

Private Methods

Méthode Description
getMasterOrDie ( ) : Predis\Connection\NodeConnectionInterface Returns the connection associated to the master server.
handleInfoResponse ( string $response ) : array Handles response from INFO.
retryCommandOnFailure ( Predis\Command\CommandInterface $command, string $method ) : mixed Retries the execution of a command upon slave failure.

Method Details

__construct() public méthode

public __construct ( ReplicationStrategy $strategy = null )
$strategy Predis\Replication\ReplicationStrategy

__sleep() public méthode

public __sleep ( )

add() public méthode

public add ( Predis\Connection\NodeConnectionInterface $connection )
$connection Predis\Connection\NodeConnectionInterface

connect() public méthode

public connect ( )

disconnect() public méthode

public disconnect ( )

discover() public méthode

Fetches the replication configuration from one of the servers.
public discover ( )

discoverFromMaster() protected méthode

Discovers the replication configuration by contacting the master node.
protected discoverFromMaster ( Predis\Connection\NodeConnectionInterface $connection, Predis\Connection\FactoryInterface $connectionFactory )
$connection Predis\Connection\NodeConnectionInterface Connection to the master node.
$connectionFactory Predis\Connection\FactoryInterface Connection factory instance.

discoverFromSlave() protected méthode

Discovers the replication configuration by contacting one of the slaves.
protected discoverFromSlave ( Predis\Connection\NodeConnectionInterface $connection, Predis\Connection\FactoryInterface $connectionFactory )
$connection Predis\Connection\NodeConnectionInterface Connection to one of the slaves.
$connectionFactory Predis\Connection\FactoryInterface Connection factory instance.

executeCommand() public méthode

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

getConnection() public méthode

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

getConnectionById() public méthode

public getConnectionById ( $connectionId )

getCurrent() public méthode

public getCurrent ( )

getMaster() public méthode

public getMaster ( )

getReplicationStrategy() public méthode

Returns the underlying replication strategy.
public getReplicationStrategy ( ) : ReplicationStrategy
Résultat Predis\Replication\ReplicationStrategy

getSlaves() public méthode

public getSlaves ( )

isConnected() public méthode

public isConnected ( )

pickSlave() protected méthode

Returns a random slave.
protected pickSlave ( ) : Predis\Connection\NodeConnectionInterface
Résultat Predis\Connection\NodeConnectionInterface

readResponse() public méthode

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

remove() public méthode

public remove ( Predis\Connection\NodeConnectionInterface $connection )
$connection Predis\Connection\NodeConnectionInterface

reset() protected méthode

Resets the connection state.
protected reset ( )

setAutoDiscovery() public méthode

Configures the automatic discovery of the replication configuration on failure.
public setAutoDiscovery ( boolean $value )
$value boolean Enable or disable auto discovery.

setConnectionFactory() public méthode

Sets the connection factory used to create the connections by the auto discovery procedure.
public setConnectionFactory ( Predis\Connection\FactoryInterface $connectionFactory )
$connectionFactory Predis\Connection\FactoryInterface Connection factory instance.

switchTo() public méthode

public switchTo ( $connection )

switchToMaster() public méthode

Switches to the master server.
public switchToMaster ( )

switchToSlave() public méthode

Switches to a random slave server.
public switchToSlave ( )

writeRequest() public méthode

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

Property Details

$autoDiscovery protected_oe property

protected bool $autoDiscovery
Résultat boolean

$connectionFactory protected_oe property

protected FactoryInterface,Predis\Connection $connectionFactory
Résultat Predis\Connection\FactoryInterface

$current protected_oe property

protected NodeConnectionInterface,Predis\Connection $current
Résultat Predis\Connection\NodeConnectionInterface

$master protected_oe property

protected NodeConnectionInterface,Predis\Connection $master
Résultat Predis\Connection\NodeConnectionInterface

$slaves protected_oe property

protected NodeConnectionInterface[],Predis\Connection $slaves
Résultat Predis\Connection\NodeConnectionInterface[]

$strategy protected_oe property

protected ReplicationStrategy,Predis\Replication $strategy
Résultat Predis\Replication\ReplicationStrategy