本文整理汇总了PHP中LoadBalancer::waitFor方法的典型用法代码示例。如果您正苦于以下问题:PHP LoadBalancer::waitFor方法的具体用法?PHP LoadBalancer::waitFor怎么用?PHP LoadBalancer::waitFor使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LoadBalancer
的用法示例。
在下文中一共展示了LoadBalancer::waitFor方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: initLB
/**
* Initialise a LoadBalancer to give it appropriate chronology protection.
*
* If the session has a previous master position recorded, this will try to
* make sure that the next query to a slave of that master will see changes up
* to that position by delaying execution. The delay may timeout and allow stale
* data if no non-lagged slaves are available.
*
* @param LoadBalancer $lb
* @return void
*/
public function initLB(LoadBalancer $lb)
{
if ($lb->getServerCount() <= 1) {
return;
// non-replicated setup
}
if (!$this->initialized) {
$this->initialized = true;
if (isset($_SESSION[__CLASS__]) && is_array($_SESSION[__CLASS__])) {
$this->startupPositions = $_SESSION[__CLASS__];
}
}
$masterName = $lb->getServerName(0);
if (!empty($this->startupPositions[$masterName])) {
$info = $lb->parentInfo();
$pos = $this->startupPositions[$masterName];
wfDebug(__METHOD__ . ": LB " . $info['id'] . " waiting for master pos {$pos}\n");
$lb->waitFor($pos);
}
}
示例2: initLB
/**
* Initialise a LoadBalancer to give it appropriate chronology protection.
*
* @param LoadBalancer $lb
*/
function initLB($lb)
{
if ($this->startupPos === null) {
if (!empty($_SESSION[__CLASS__])) {
$this->startupPos = $_SESSION[__CLASS__];
}
}
if (!$this->startupPos) {
return;
}
$masterName = $lb->getServerName(0);
if ($lb->getServerCount() > 1 && !empty($this->startupPos[$masterName])) {
$info = $lb->parentInfo();
$pos = $this->startupPos[$masterName];
wfDebug(__METHOD__ . ": LB " . $info['id'] . " waiting for master pos {$pos}\n");
$lb->waitFor($this->startupPos[$masterName]);
}
}
示例3: initLB
/**
* Initialise a LoadBalancer to give it appropriate chronology protection.
*
* If the stash has a previous master position recorded, this will try to
* make sure that the next query to a slave of that master will see changes up
* to that position by delaying execution. The delay may timeout and allow stale
* data if no non-lagged slaves are available.
*
* @param LoadBalancer $lb
* @return void
*/
public function initLB(LoadBalancer $lb)
{
if (!$this->enabled || $lb->getServerCount() <= 1) {
return;
// non-replicated setup or disabled
}
$this->initPositions();
$masterName = $lb->getServerName($lb->getWriterIndex());
if (!empty($this->startupPositions[$masterName])) {
$info = $lb->parentInfo();
$pos = $this->startupPositions[$masterName];
wfDebugLog('replication', __METHOD__ . ": LB '" . $info['id'] . "' waiting for master pos {$pos}\n");
$lb->waitFor($pos);
}
}