PHP 클래스 Predis\Connection\Aggregate\SentinelReplication

저자: Daniele Alessandri ([email protected])
저자: Ville Mattila ([email protected])
상속: implements Predis\Connection\Aggregate\ReplicationInterface
파일 보기 프로젝트 열기: tillkruss/redis-object-cache

보호된 프로퍼티들

프로퍼티 타입 설명
$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 Predis\Replication\ReplicationStrategy
$updateSentinels boolean Flag for automatic fetching of available sentinels.

공개 메소드들

메소드 설명
__construct ( string $service, array $sentinels, ConnectionFactoryInterface $connectionFactory, ReplicationStrategy $strategy = null )
__sleep ( )
add ( Predis\Connection\NodeConnectionInterface $connection )
connect ( )
disconnect ( )
executeCommand ( Predis\Command\CommandInterface $command )
getConnection ( Predis\Command\CommandInterface $command )
getConnectionById ( $connectionId )
getCurrent ( )
getMaster ( )
getReplicationStrategy ( ) : ReplicationStrategy 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.

메소드 상세

__construct() 공개 메소드

public __construct ( string $service, array $sentinels, ConnectionFactoryInterface $connectionFactory, ReplicationStrategy $strategy = null )
$service string Name of the service for autodiscovery.
$sentinels array Sentinel servers connection parameters.
$connectionFactory ConnectionFactoryInterface Connection factory instance.
$strategy Predis\Replication\ReplicationStrategy Replication strategy instance.

__sleep() 공개 메소드

public __sleep ( )

add() 공개 메소드

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

assertConnectionRole() 보호된 메소드

Asserts that the specified connection matches an expected role.
protected assertConnectionRole ( Predis\Connection\NodeConnectionInterface $connection, string $role )
$connection Predis\Connection\NodeConnectionInterface
$role string Expected role of the server ("master", "slave" or "sentinel").

connect() 공개 메소드

public connect ( )

createSentinelConnection() 보호된 메소드

Creates a new connection to a sentinel server.
protected createSentinelConnection ( $parameters ) : Predis\Connection\NodeConnectionInterface
리턴 Predis\Connection\NodeConnectionInterface

disconnect() 공개 메소드

public disconnect ( )

executeCommand() 공개 메소드

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

getConnection() 공개 메소드

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

getConnectionById() 공개 메소드

public getConnectionById ( $connectionId )

getCurrent() 공개 메소드

public getCurrent ( )

getMaster() 공개 메소드

public getMaster ( )

getReplicationStrategy() 공개 메소드

Returns the underlying replication strategy.
public getReplicationStrategy ( ) : ReplicationStrategy
리턴 Predis\Replication\ReplicationStrategy

getSentinelConnection() 공개 메소드

If there is no active sentinel connection, a new connection is created.
public getSentinelConnection ( ) : Predis\Connection\NodeConnectionInterface
리턴 Predis\Connection\NodeConnectionInterface

getSlaves() 공개 메소드

public getSlaves ( )

isConnected() 공개 메소드

public isConnected ( )

pickSlave() 보호된 메소드

Returns a random slave.
protected pickSlave ( ) : Predis\Connection\NodeConnectionInterface
리턴 Predis\Connection\NodeConnectionInterface

querySentinel() 공개 메소드

Fetches the details for the master and slave servers from a sentinel.
public querySentinel ( )

querySentinelForMaster() 보호된 메소드

Fetches the details for the master server from a sentinel.
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

querySentinelForSlaves() 보호된 메소드

Fetches the details for the slave servers from a sentinel.
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

readResponse() 공개 메소드

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

remove() 공개 메소드

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

reset() 보호된 메소드

Resets the current connection.
protected reset ( )

setRetryLimit() 공개 메소드

-1 = unlimited retry attempts 0 = no retry attempts (fails immediatly) n = fail only after n retry attempts
public setRetryLimit ( integer $retry )
$retry integer Number of retry attempts.

setRetryWait() 공개 메소드

Sets the time to wait (in seconds) before fetching a new configuration from one of the sentinels.
public setRetryWait ( float $seconds )
$seconds float Time to wait before the next attempt.

setSentinelTimeout() 공개 메소드

When "timeout" is present in the connection parameters of sentinels, its value overrides the default sentinel timeout.
public setSentinelTimeout ( float $timeout )
$timeout float Timeout value.

setUpdateSentinels() 공개 메소드

Set automatic fetching of available sentinels.
public setUpdateSentinels ( boolean $update )
$update boolean Enable or disable automatic updates.

switchTo() 공개 메소드

public switchTo ( $connection )

switchToMaster() 공개 메소드

Switches to the master server.
public switchToMaster ( )

switchToSlave() 공개 메소드

Switches to a random slave server.
public switchToSlave ( )

updateSentinels() 공개 메소드

Fetches an updated list of sentinels from a sentinel.
public updateSentinels ( )

wipeServerList() 보호된 메소드

Wipes the current list of master and slaves nodes.
protected wipeServerList ( )

writeRequest() 공개 메소드

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

프로퍼티 상세

$connectionFactory 보호되어 있는 프로퍼티

protected ConnectionFactoryInterface $connectionFactory
리턴 ConnectionFactoryInterface

$current 보호되어 있는 프로퍼티

protected NodeConnectionInterface,Predis\Connection $current
리턴 Predis\Connection\NodeConnectionInterface

$master 보호되어 있는 프로퍼티

protected NodeConnectionInterface,Predis\Connection $master
리턴 Predis\Connection\NodeConnectionInterface

$retryLimit 보호되어 있는 프로퍼티

-1 = unlimited retry attempts 0 = no retry attempts (fails immediatly) n = fail only after n retry attempts
protected int $retryLimit
리턴 integer

$retryWait 보호되어 있는 프로퍼티

Time to wait in milliseconds before fetching a new configuration from one of the sentinel servers.
protected int $retryWait
리턴 integer

$sentinelConnection 보호되어 있는 프로퍼티

protected NodeConnectionInterface,Predis\Connection $sentinelConnection
리턴 Predis\Connection\NodeConnectionInterface

$sentinelTimeout 보호되어 있는 프로퍼티

protected float $sentinelTimeout
리턴 float

$sentinels 보호되어 있는 프로퍼티

protected NodeConnectionInterface[],Predis\Connection $sentinels
리턴 Predis\Connection\NodeConnectionInterface[]

$service 보호되어 있는 프로퍼티

protected string $service
리턴 string

$slaves 보호되어 있는 프로퍼티

protected NodeConnectionInterface[],Predis\Connection $slaves
리턴 Predis\Connection\NodeConnectionInterface[]

$strategy 보호되어 있는 프로퍼티

protected ReplicationStrategy,Predis\Replication $strategy
리턴 Predis\Replication\ReplicationStrategy

$updateSentinels 보호되어 있는 프로퍼티

Flag for automatic fetching of available sentinels.
protected bool $updateSentinels
리턴 boolean