PHP Class Bravo3\Orm\Drivers\Redis\SentinelMonitor

Show file Open project: bravo3/orm

Protected Properties

Property Type Description
$client Predis\Client

Public Methods

Method Description
__construct ( mixed $connection_params = null ) Create a new Sentinel Monitor.
findMasters ( ) : array Return an array of MASTER servers in the form that can be passed to Predis Client.
findSentinels ( string $master_name = 'mymaster' ) : array Return an array of SENTINEL servers in the form that can be passed to Predis Client.
findSlaves ( string $master_name = null ) : array Return an array of SLAVE servers in the form that can be passed to Predis Client.

Protected Methods

Method Description
getConnectionParams ( array $sentinel_output, string $alias = null ) : array | null Return an array of formatted output from Sentinel to be used as Redis connection parameters for the Predis client.
validateConnection ( array $host_info ) : boolean Function returns true if connection to redis host is accessible based on the output received from Sentinel.

Method Details

__construct() public method

If more than one sentinel server parameters are provided, the first sentinel that connects will be used for retrival of information.
public __construct ( mixed $connection_params = null )
$connection_params mixed

findMasters() public method

Return an array of MASTER servers in the form that can be passed to Predis Client.
public findMasters ( ) : array
return array

findSentinels() public method

Return an array of SENTINEL servers in the form that can be passed to Predis Client.
public findSentinels ( string $master_name = 'mymaster' ) : array
$master_name string
return array

findSlaves() public method

If $master_name parameter is not set this function will return slaves attached to all connected master servers.
public findSlaves ( string $master_name = null ) : array
$master_name string
return array

getConnectionParams() protected method

Inactive connection parameters will be removed if sentinel reports services as inactive.
protected getConnectionParams ( array $sentinel_output, string $alias = null ) : array | null
$sentinel_output array
$alias string Redis DB connection type "master" or "slave"
return array | null

validateConnection() protected method

Function returns true if connection to redis host is accessible based on the output received from Sentinel.
protected validateConnection ( array $host_info ) : boolean
$host_info array
return boolean

Property Details

$client protected property

protected Client,Predis $client
return Predis\Client