Свойство | Тип | Описание | |
---|---|---|---|
$connectionFactory | ConnectionFactoryInterface | ||
$current | Predis\Connection\NodeConnectionInterface | ||
$master | Predis\Connection\NodeConnectionInterface | ||
$retryLimit | integer | -1 = unlimited retry attempts 0 = no retry attempts (fails immediatly) n = fail only after n retry attempts | |
$retryWait | integer | Time to wait in milliseconds before fetching a new configuration from one of the sentinel servers. | |
$sentinelConnection | Predis\Connection\NodeConnectionInterface | ||
$sentinelTimeout | float | ||
$sentinels | Predis\Connection\NodeConnectionInterface[] | ||
$service | string | ||
$slaves | Predis\Connection\NodeConnectionInterface[] | ||
$strategy | |||
$updateSentinels | boolean | Flag for automatic fetching of available sentinels. |
Метод | Описание | |
---|---|---|
__construct ( string $service, array $sentinels, ConnectionFactoryInterface $connectionFactory, |
||
__sleep ( ) | ||
add ( Predis\Connection\NodeConnectionInterface $connection ) | ||
connect ( ) | ||
disconnect ( ) | ||
executeCommand ( Predis\Command\CommandInterface $command ) | ||
getConnection ( Predis\Command\CommandInterface $command ) | ||
getConnectionById ( $connectionId ) | ||
getCurrent ( ) | ||
getMaster ( ) | ||
getReplicationStrategy ( ) : |
Returns the underlying replication strategy. | |
getSentinelConnection ( ) : Predis\Connection\NodeConnectionInterface | Returns the current sentinel connection. | |
getSlaves ( ) | ||
isConnected ( ) | ||
querySentinel ( ) | Fetches the details for the master and slave servers from a sentinel. | |
readResponse ( Predis\Command\CommandInterface $command ) | ||
remove ( Predis\Connection\NodeConnectionInterface $connection ) | ||
setRetryLimit ( integer $retry ) | Sets the maximum number of retries for commands upon server failure. | |
setRetryWait ( float $seconds ) | Sets the time to wait (in seconds) before fetching a new configuration from one of the sentinels. | |
setSentinelTimeout ( float $timeout ) | Sets a default timeout for connections to sentinels. | |
setUpdateSentinels ( boolean $update ) | Set automatic fetching of available sentinels. | |
switchTo ( $connection ) | ||
switchToMaster ( ) | Switches to the master server. | |
switchToSlave ( ) | Switches to a random slave server. | |
updateSentinels ( ) | Fetches an updated list of sentinels from a sentinel. | |
writeRequest ( Predis\Command\CommandInterface $command ) |
Метод | Описание | |
---|---|---|
assertConnectionRole ( Predis\Connection\NodeConnectionInterface $connection, string $role ) | Asserts that the specified connection matches an expected role. | |
createSentinelConnection ( $parameters ) : Predis\Connection\NodeConnectionInterface | Creates a new connection to a sentinel server. | |
pickSlave ( ) : Predis\Connection\NodeConnectionInterface | Returns a random slave. | |
querySentinelForMaster ( Predis\Connection\NodeConnectionInterface $sentinel, string $service ) : array | Fetches the details for the master server from a sentinel. | |
querySentinelForSlaves ( Predis\Connection\NodeConnectionInterface $sentinel, string $service ) : array | Fetches the details for the slave servers from a sentinel. | |
reset ( ) | Resets the current connection. | |
wipeServerList ( ) | Wipes the current list of master and slaves nodes. |
Метод | Описание | |
---|---|---|
getConnectionInternal ( Predis\Command\CommandInterface $command ) : Predis\Connection\NodeConnectionInterface | Returns the connection instance in charge for the given command. | |
handleSentinelErrorResponse ( Predis\Connection\NodeConnectionInterface $sentinel, ErrorResponseInterface $error ) | Handles error responses returned by redis-sentinel. | |
retryCommandOnFailure ( Predis\Command\CommandInterface $command, string $method ) : mixed | Retries the execution of a command upon server failure after asking a new configuration to one of the sentinels. |
public __construct ( string $service, array $sentinels, ConnectionFactoryInterface $connectionFactory, |
||
$service | string | Name of the service for autodiscovery. |
$sentinels | array | Sentinel servers connection parameters. |
$connectionFactory | ConnectionFactoryInterface | Connection factory instance. |
$strategy | Replication strategy instance. |
public add ( Predis\Connection\NodeConnectionInterface $connection ) | ||
$connection | Predis\Connection\NodeConnectionInterface |
protected assertConnectionRole ( Predis\Connection\NodeConnectionInterface $connection, string $role ) | ||
$connection | Predis\Connection\NodeConnectionInterface | |
$role | string | Expected role of the server ("master", "slave" or "sentinel"). |
protected createSentinelConnection ( $parameters ) : Predis\Connection\NodeConnectionInterface | ||
Результат | Predis\Connection\NodeConnectionInterface |
public executeCommand ( Predis\Command\CommandInterface $command ) | ||
$command | Predis\Command\CommandInterface |
public getConnection ( Predis\Command\CommandInterface $command ) | ||
$command | Predis\Command\CommandInterface |
public getReplicationStrategy ( ) : |
||
Результат |
public getSentinelConnection ( ) : Predis\Connection\NodeConnectionInterface | ||
Результат | Predis\Connection\NodeConnectionInterface |
protected pickSlave ( ) : Predis\Connection\NodeConnectionInterface | ||
Результат | Predis\Connection\NodeConnectionInterface |
public querySentinel ( ) |
protected querySentinelForMaster ( Predis\Connection\NodeConnectionInterface $sentinel, string $service ) : array | ||
$sentinel | Predis\Connection\NodeConnectionInterface | Connection to a sentinel server. |
$service | string | Name of the service. |
Результат | array |
protected querySentinelForSlaves ( Predis\Connection\NodeConnectionInterface $sentinel, string $service ) : array | ||
$sentinel | Predis\Connection\NodeConnectionInterface | Connection to a sentinel server. |
$service | string | Name of the service. |
Результат | array |
public readResponse ( Predis\Command\CommandInterface $command ) | ||
$command | Predis\Command\CommandInterface |
public remove ( Predis\Connection\NodeConnectionInterface $connection ) | ||
$connection | Predis\Connection\NodeConnectionInterface |
public setRetryLimit ( integer $retry ) | ||
$retry | integer | Number of retry attempts. |
public setRetryWait ( float $seconds ) | ||
$seconds | float | Time to wait before the next attempt. |
public setSentinelTimeout ( float $timeout ) | ||
$timeout | float | Timeout value. |
public setUpdateSentinels ( boolean $update ) | ||
$update | boolean | Enable or disable automatic updates. |
public updateSentinels ( ) |
protected wipeServerList ( ) |
public writeRequest ( Predis\Command\CommandInterface $command ) | ||
$command | Predis\Command\CommandInterface |
protected ConnectionFactoryInterface $connectionFactory | ||
Результат | ConnectionFactoryInterface |
protected NodeConnectionInterface,Predis\Connection $current | ||
Результат | Predis\Connection\NodeConnectionInterface |
protected NodeConnectionInterface,Predis\Connection $master | ||
Результат | Predis\Connection\NodeConnectionInterface |
protected int $retryLimit | ||
Результат | integer |
protected int $retryWait | ||
Результат | integer |
protected NodeConnectionInterface,Predis\Connection $sentinelConnection | ||
Результат | Predis\Connection\NodeConnectionInterface |
protected NodeConnectionInterface[],Predis\Connection $sentinels | ||
Результат | Predis\Connection\NodeConnectionInterface[] |
protected NodeConnectionInterface[],Predis\Connection $slaves | ||
Результат | Predis\Connection\NodeConnectionInterface[] |
protected ReplicationStrategy,Predis\Replication $strategy | ||
Результат |
protected bool $updateSentinels | ||
Результат | boolean |