当前位置: 首页>>代码示例>>PHP>>正文


PHP LoadBalancer::getWriterIndex方法代码示例

本文整理汇总了PHP中LoadBalancer::getWriterIndex方法的典型用法代码示例。如果您正苦于以下问题:PHP LoadBalancer::getWriterIndex方法的具体用法?PHP LoadBalancer::getWriterIndex怎么用?PHP LoadBalancer::getWriterIndex使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在LoadBalancer的用法示例。


在下文中一共展示了LoadBalancer::getWriterIndex方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: shutdownLB

 /**
  * Notify the ChronologyProtector that the LoadBalancer is about to shut
  * down. Saves replication positions.
  *
  * @param LoadBalancer $lb
  * @return void
  */
 public function shutdownLB(LoadBalancer $lb)
 {
     if (!$this->enabled || $lb->getServerCount() <= 1) {
         return;
         // non-replicated setup or disabled
     }
     $info = $lb->parentInfo();
     $masterName = $lb->getServerName($lb->getWriterIndex());
     // Only save the position if writes have been done on the connection
     $db = $lb->getAnyOpenConnection($lb->getWriterIndex());
     if (!$db || !$db->doneWrites()) {
         wfDebugLog('replication', __METHOD__ . ": LB {$info['id']}, no writes done\n");
         return;
         // nothing to do
     }
     $pos = $db->getMasterPos();
     wfDebugLog('replication', __METHOD__ . ": LB {$info['id']} has master pos {$pos}\n");
     $this->shutdownPositions[$masterName] = $pos;
 }
开发者ID:mb720,项目名称:mediawiki,代码行数:26,代码来源:ChronologyProtector.php

示例2: getLagTimeCacheKey

 private function getLagTimeCacheKey()
 {
     $writerIndex = $this->parent->getWriterIndex();
     // Lag is per-server, not per-DB, so key on the master DB name
     return $this->srvCache->makeGlobalKey('lag-times', $this->parent->getServerName($writerIndex));
 }
开发者ID:claudinec,项目名称:galan-wiki,代码行数:6,代码来源:LoadMonitorMySQL.php


注:本文中的LoadBalancer::getWriterIndex方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。