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


PHP LBFactory::__construct方法代码示例

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


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

示例1: __construct

 /**
  * @param array $conf An associative array with one member:
  *  - connection: The IDatabase connection object
  */
 public function __construct(array $conf)
 {
     parent::__construct($conf);
     if (!isset($conf['connection'])) {
         throw new InvalidArgumentException("Missing 'connection' argument.");
     }
     $lb = new LoadBalancerSingle(array_merge($this->baseLoadBalancerParams(), $conf));
     $this->initLoadBalancer($lb);
     $this->lb = $lb;
 }
开发者ID:paladox,项目名称:mediawiki,代码行数:14,代码来源:LBFactorySingle.php

示例2: __construct

 /**
  * @see LBFactory::__construct()
  * @param array $conf Parameters of LBFactory::__construct() as well as:
  *   - servers : list of server configuration maps to Database::factory().
  *      Additionally, the server maps should have a 'load' key, which is used to decide
  *      how often clients connect to one server verses the others. A 'max lag' key should
  *      also be set on server maps, indicating how stale the data can be before the load
  *      balancer tries to avoid using it. The map can have 'is static' set to disable blocking
  *      replication sync checks (intended for archive servers with unchanging data).
  *   - externalClusters : map of cluster names to server arrays. The servers arrays have the
  *      same format as "servers" above.
  */
 public function __construct(array $conf)
 {
     parent::__construct($conf);
     $this->servers = isset($conf['servers']) ? $conf['servers'] : [];
     foreach ($this->servers as $i => $server) {
         if ($i == 0) {
             $this->servers[$i]['master'] = true;
         } else {
             $this->servers[$i]['replica'] = true;
         }
     }
     $this->externalClusters = isset($conf['externalClusters']) ? $conf['externalClusters'] : [];
     $this->loadMonitorClass = isset($conf['loadMonitorClass']) ? $conf['loadMonitorClass'] : 'LoadMonitor';
 }
开发者ID:paladox,项目名称:mediawiki,代码行数:26,代码来源:LBFactorySimple.php

示例3: __construct

 /**
  * @param array $conf
  * @throws MWException
  */
 public function __construct(array $conf)
 {
     parent::__construct($conf);
     $this->chronProt = new ChronologyProtector();
     $this->conf = $conf;
     $required = array('sectionsByDB', 'sectionLoads', 'serverTemplate');
     $optional = array('groupLoadsBySection', 'groupLoadsByDB', 'hostsByName', 'externalLoads', 'externalTemplateOverrides', 'templateOverridesByServer', 'templateOverridesByCluster', 'masterTemplateOverrides', 'readOnlyBySection', 'loadMonitorClass');
     foreach ($required as $key) {
         if (!isset($conf[$key])) {
             throw new MWException(__CLASS__ . ": {$key} is required in configuration");
         }
         $this->{$key} = $conf[$key];
     }
     foreach ($optional as $key) {
         if (isset($conf[$key])) {
             $this->{$key} = $conf[$key];
         }
     }
 }
开发者ID:rrameshs,项目名称:mediawiki,代码行数:23,代码来源:LBFactoryMulti.php

示例4: __construct

 public function __construct(array $conf)
 {
     parent::__construct($conf);
     $this->loadMonitorClass = isset($conf['loadMonitorClass']) ? $conf['loadMonitorClass'] : null;
 }
开发者ID:Gomyul,项目名称:mediawiki,代码行数:5,代码来源:LBFactorySimple.php

示例5: __construct

 /**
  * @param array $conf An associative array with one member:
  *  - connection: The DatabaseBase connection object
  */
 public function __construct(array $conf)
 {
     parent::__construct($conf);
     $this->lb = new LoadBalancerSingle(['readOnlyReason' => $this->readOnlyReason, 'trxProfiler' => $this->trxProfiler] + $conf);
 }
开发者ID:claudinec,项目名称:galan-wiki,代码行数:9,代码来源:LBFactorySingle.php

示例6: __construct

 public function __construct(array $conf)
 {
     parent::__construct($conf);
     $this->chronProt = new ChronologyProtector();
     $this->loadMonitorClass = isset($conf['loadMonitorClass']) ? $conf['loadMonitorClass'] : null;
 }
开发者ID:rrameshs,项目名称:mediawiki,代码行数:6,代码来源:LBFactorySimple.php

示例7: __construct

 /**
  * @see LBFactory::__construct()
  *
  * Template override precedence (highest => lowest):
  *   - templateOverridesByServer
  *   - masterTemplateOverrides
  *   - templateOverridesBySection/templateOverridesByCluster
  *   - externalTemplateOverrides
  *   - serverTemplate
  * Overrides only work on top level keys (so nested values will not be merged).
  *
  * Server configuration maps should be of the format Database::factory() requires.
  * Additionally, a 'max lag' key should also be set on server maps, indicating how stale the
  * data can be before the load balancer tries to avoid using it. The map can have 'is static'
  * set to disable blocking  replication sync checks (intended for archive servers with
  * unchanging data).
  *
  * @param array $conf Parameters of LBFactory::__construct() as well as:
  *   - sectionsByDB                Map of database names to section names.
  *   - sectionLoads                2-d map. For each section, gives a map of server names to
  *                                 load ratios. For example:
  *                                 [
  *                                     'section1' => [
  *                                         'db1' => 100,
  *                                         'db2' => 100
  *                                     ]
  *                                 ]
  *   - serverTemplate              Server configuration map intended for Database::factory().
  *                                 Note that "host", "hostName" and "load" entries will be
  *                                 overridden by "sectionLoads" and "hostsByName".
  *   - groupLoadsBySection         3-d map giving server load ratios for each section/group.
  *                                 For example:
  *                                 [
  *                                     'section1' => [
  *                                         'group1' => [
  *                                             'db1' => 100,
  *                                             'db2' => 100
  *                                         ]
  *                                     ]
  *                                 ]
  *   - groupLoadsByDB              3-d map giving server load ratios by DB name.
  *   - hostsByName                 Map of hostname to IP address.
  *   - externalLoads               Map of external storage cluster name to server load map.
  *   - externalTemplateOverrides   Set of server configuration maps overriding
  *                                 "serverTemplate" for external storage.
  *   - templateOverridesByServer   2-d map overriding "serverTemplate" and
  *                                 "externalTemplateOverrides" on a server-by-server basis.
  *                                 Applies to both core and external storage.
  *   - templateOverridesBySection  2-d map overriding the server configuration maps by section.
  *   - templateOverridesByCluster  2-d map overriding the server configuration maps by external
  *                                 storage cluster.
  *   - masterTemplateOverrides     Server configuration map overrides for all master servers.
  *   - loadMonitorClass            Name of the LoadMonitor class to always use.
  *   - readOnlyBySection           A map of section name to read-only message.
  *                                 Missing or false for read/write.
  */
 public function __construct(array $conf)
 {
     parent::__construct($conf);
     $this->conf = $conf;
     $required = ['sectionsByDB', 'sectionLoads', 'serverTemplate'];
     $optional = ['groupLoadsBySection', 'groupLoadsByDB', 'hostsByName', 'externalLoads', 'externalTemplateOverrides', 'templateOverridesByServer', 'templateOverridesByCluster', 'templateOverridesBySection', 'masterTemplateOverrides', 'readOnlyBySection', 'loadMonitorClass'];
     foreach ($required as $key) {
         if (!isset($conf[$key])) {
             throw new InvalidArgumentException(__CLASS__ . ": {$key} is required.");
         }
         $this->{$key} = $conf[$key];
     }
     foreach ($optional as $key) {
         if (isset($conf[$key])) {
             $this->{$key} = $conf[$key];
         }
     }
 }
开发者ID:paladox,项目名称:mediawiki,代码行数:74,代码来源:LBFactoryMulti.php

示例8: __construct

 /**
  * @param array $conf An associative array with one member:
  *  - connection: The DatabaseBase connection object
  */
 public function __construct(array $conf)
 {
     parent::__construct($conf);
     $this->lb = new LoadBalancerSingle($conf);
 }
开发者ID:rrameshs,项目名称:mediawiki,代码行数:9,代码来源:LBFactorySingle.php

示例9: __construct

 /**
  * @param array $conf An associative array with one member:
  *  - connection: The DatabaseBase connection object
  */
 public function __construct(array $conf)
 {
     parent::__construct($conf);
     $conf['readOnlyReason'] = $this->readOnlyReason;
     $this->lb = new LoadBalancerSingle($conf);
 }
开发者ID:Acidburn0zzz,项目名称:mediawiki,代码行数:10,代码来源:LBFactorySingle.php


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