本文整理汇总了PHP中LoadBalancer::__construct方法的典型用法代码示例。如果您正苦于以下问题:PHP LoadBalancer::__construct方法的具体用法?PHP LoadBalancer::__construct怎么用?PHP LoadBalancer::__construct使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LoadBalancer
的用法示例。
在下文中一共展示了LoadBalancer::__construct方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* @param array $params An associative array with one member:
* - connection: An IDatabase connection object
*/
public function __construct(array $params)
{
if (!isset($params['connection'])) {
throw new InvalidArgumentException("Missing 'connection' argument.");
}
$this->db = $params['connection'];
parent::__construct(['servers' => [['type' => $this->db->getType(), 'host' => $this->db->getServer(), 'dbname' => $this->db->getDBname(), 'load' => 1]], 'trxProfiler' => isset($params['trxProfiler']) ? $params['trxProfiler'] : null, 'srvCache' => isset($params['srvCache']) ? $params['srvCache'] : null, 'wanCache' => isset($params['wanCache']) ? $params['wanCache'] : null]);
if (isset($params['readOnlyReason'])) {
$this->db->setLBInfo('readOnlyReason', $params['readOnlyReason']);
}
}
示例2: array
/**
* @param $params array
*/
function __construct($params)
{
$this->db = $params['connection'];
parent::__construct(array('servers' => array(array('type' => $this->db->getType(), 'host' => $this->db->getServer(), 'dbname' => $this->db->getDBname(), 'load' => 1))));
}
示例3: __construct
/**
* @param array $params
*/
public function __construct(array $params)
{
$this->db = $params['connection'];
parent::__construct(['servers' => [['type' => $this->db->getType(), 'host' => $this->db->getServer(), 'dbname' => $this->db->getDBname(), 'load' => 1]], 'trxProfiler' => $this->trxProfiler]);
if (isset($params['readOnlyReason'])) {
$this->db->setLBInfo('readOnlyReason', $params['readOnlyReason']);
}
}