26use InvalidArgumentException;
40 if ( !isset(
$params[
'connection'] ) ) {
41 throw new InvalidArgumentException(
"Missing 'connection' argument." );
44 $this->db =
$params[
'connection'];
46 parent::__construct( [
49 'type' => $this->db->getType(),
50 'host' => $this->db->getServer(),
51 'dbname' => $this->db->getDBname(),
55 'trxProfiler' =>
$params[
'trxProfiler'] ??
null,
56 'srvCache' =>
$params[
'srvCache'] ??
null,
57 'wanCache' =>
$params[
'wanCache'] ??
null,
58 'localDomain' =>
$params[
'localDomain'] ?? $this->db->getDomainID()
61 if ( isset(
$params[
'readOnlyReason'] ) ) {
62 $this->db->setLBInfo(
'readOnlyReason',
$params[
'readOnlyReason'] );
73 return new static( array_merge(
76 [
'connection' =>
$db ]
88class_alias( LoadBalancerSingle::class,
'LoadBalancerSingle' );
Class to handle database/prefix specification for IDatabase domains.
The wiki should then use memcached to cache various data To use multiple just add more items to the array To increase the weight of a make its entry a array("192.168.0.1:11211", 2))