PHP 클래스 Predis\Connection\Replication\MasterSlaveReplication

저자: Daniele Alessandri ([email protected])
상속: implements Predis\Connection\Replication\ReplicationInterface
파일 보기 프로젝트 열기: nrk/predis 1 사용 예제들

보호된 프로퍼티들

프로퍼티 타입 설명
$aliases Predis\Connection\NodeConnectionInterface[]
$autoDiscovery boolean
$connectionFactory Predis\Connection\FactoryInterface
$current Predis\Connection\NodeConnectionInterface
$master Predis\Connection\NodeConnectionInterface
$pool Predis\Connection\NodeConnectionInterface[]
$slaves Predis\Connection\NodeConnectionInterface[]
$strategy Predis\Replication\ReplicationStrategy

공개 메소드들

메소드 설명
__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 )
getConnectionByAlias ( string $alias ) : Predis\Connection\NodeConnectionInterface | null Returns a connection instance by its alias.
getConnectionByCommand ( Predis\Command\CommandInterface $command )
getConnectionById ( $id )
getConnectionByRole ( string $role ) : Predis\Connection\NodeConnectionInterface | null Returns a connection by its role.
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 ( Predis\Connection\NodeConnectionInterface $connection ) Switches the internal connection in use by the backend.
switchToMaster ( )
switchToSlave ( )
writeRequest ( Predis\Command\CommandInterface $command )

보호된 메소드들

메소드 설명
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.

비공개 메소드들

메소드 설명
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.

메소드 상세

__construct() 공개 메소드

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

__sleep() 공개 메소드

public __sleep ( )

add() 공개 메소드

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

connect() 공개 메소드

public connect ( )

disconnect() 공개 메소드

public disconnect ( )

discover() 공개 메소드

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

discoverFromMaster() 보호된 메소드

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() 보호된 메소드

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 executeCommand ( Predis\Command\CommandInterface $command )
$command Predis\Command\CommandInterface

getConnectionByAlias() 공개 메소드

Returns a connection instance by its alias.
public getConnectionByAlias ( string $alias ) : Predis\Connection\NodeConnectionInterface | null
$alias string Connection alias.
리턴 Predis\Connection\NodeConnectionInterface | null

getConnectionByCommand() 공개 메소드

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

getConnectionById() 공개 메소드

public getConnectionById ( $id )

getConnectionByRole() 공개 메소드

Returns a connection by its role.
public getConnectionByRole ( string $role ) : Predis\Connection\NodeConnectionInterface | null
$role string Connection role (`master` or `slave`)
리턴 Predis\Connection\NodeConnectionInterface | null

getCurrent() 공개 메소드

public getCurrent ( )

getMaster() 공개 메소드

public getMaster ( )

getReplicationStrategy() 공개 메소드

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

getSlaves() 공개 메소드

public getSlaves ( )

isConnected() 공개 메소드

public isConnected ( )

pickSlave() 보호된 메소드

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

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 connection state.
protected reset ( )

setAutoDiscovery() 공개 메소드

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

setConnectionFactory() 공개 메소드

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() 공개 메소드

Switches the internal connection in use by the backend.
public switchTo ( Predis\Connection\NodeConnectionInterface $connection )
$connection Predis\Connection\NodeConnectionInterface Connection instance in the pool.

switchToMaster() 공개 메소드

public switchToMaster ( )

switchToSlave() 공개 메소드

public switchToSlave ( )

writeRequest() 공개 메소드

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

프로퍼티 상세

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

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

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

protected bool $autoDiscovery
리턴 boolean

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

protected FactoryInterface,Predis\Connection $connectionFactory
리턴 Predis\Connection\FactoryInterface

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

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

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

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

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

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

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

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

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

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