Property | Type | Description | |
---|---|---|---|
$autoDiscovery | boolean | ||
$connectionFactory | Predis\Connection\FactoryInterface | ||
$current | Predis\Connection\NodeConnectionInterface | ||
$master | Predis\Connection\NodeConnectionInterface | ||
$slaves | Predis\Connection\NodeConnectionInterface[] | ||
$strategy |
Method | Description | |
---|---|---|
__construct ( |
||
__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 ( ) : |
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 ) |
Method | 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. |
Method | 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. |
public __construct ( |
||
$strategy |
public add ( Predis\Connection\NodeConnectionInterface $connection ) | ||
$connection | Predis\Connection\NodeConnectionInterface |
public discover ( ) |
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. |
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. |
public executeCommand ( Predis\Command\CommandInterface $command ) | ||
$command | Predis\Command\CommandInterface |
public getConnection ( Predis\Command\CommandInterface $command ) | ||
$command | Predis\Command\CommandInterface |
public getReplicationStrategy ( ) : |
||
return |
protected pickSlave ( ) : Predis\Connection\NodeConnectionInterface | ||
return | Predis\Connection\NodeConnectionInterface |
public readResponse ( Predis\Command\CommandInterface $command ) | ||
$command | Predis\Command\CommandInterface |
public remove ( Predis\Connection\NodeConnectionInterface $connection ) | ||
$connection | Predis\Connection\NodeConnectionInterface |
public setAutoDiscovery ( boolean $value ) | ||
$value | boolean | Enable or disable auto discovery. |
public setConnectionFactory ( Predis\Connection\FactoryInterface $connectionFactory ) | ||
$connectionFactory | Predis\Connection\FactoryInterface | Connection factory instance. |
public writeRequest ( Predis\Command\CommandInterface $command ) | ||
$command | Predis\Command\CommandInterface |
protected FactoryInterface,Predis\Connection $connectionFactory | ||
return | Predis\Connection\FactoryInterface |
protected NodeConnectionInterface,Predis\Connection $current | ||
return | Predis\Connection\NodeConnectionInterface |
protected NodeConnectionInterface,Predis\Connection $master | ||
return | Predis\Connection\NodeConnectionInterface |
protected NodeConnectionInterface[],Predis\Connection $slaves | ||
return | Predis\Connection\NodeConnectionInterface[] |