X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Flibs%2Fobjectcache%2FReplicatedBagOStuff.php;h=3bc7ae2a8c564515438970a56256453bcb4a2730;hb=26b56403a1b31e16381ebe25e8df9afcfde36282;hp=40ac1bb3a7edb7aaf222a77947cbe15fc1248bd4;hpb=4618f70793d1178ca4c646ef397cf17b1cc70b44;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/libs/objectcache/ReplicatedBagOStuff.php b/includes/libs/objectcache/ReplicatedBagOStuff.php index 40ac1bb3a7..3bc7ae2a8c 100644 --- a/includes/libs/objectcache/ReplicatedBagOStuff.php +++ b/includes/libs/objectcache/ReplicatedBagOStuff.php @@ -22,7 +22,7 @@ /** * A cache class that directs writes to one set of servers and reads to - * another. This assumes that the servers used for reads are setup to slave + * another. This assumes that the servers used for reads are setup to replica DB * those that writes go to. This can easily be used with redis for example. * * In the WAN scenario (e.g. multi-datacenter case), this is useful when @@ -42,7 +42,7 @@ class ReplicatedBagOStuff extends BagOStuff { * - writeFactory : ObjectFactory::getObjectFromSpec array yeilding BagOStuff. * This object will be used for writes (e.g. the master DB). * - readFactory : ObjectFactory::getObjectFromSpec array yeilding BagOStuff. - * This object will be used for reads (e.g. a slave DB). + * This object will be used for reads (e.g. a replica DB). * * @param array $params * @throws InvalidArgumentException @@ -59,12 +59,14 @@ class ReplicatedBagOStuff extends BagOStuff { __METHOD__ . ': the "readFactory" parameter is required' ); } + $opts = [ 'reportDupes' => false ]; // redundant $this->writeStore = ( $params['writeFactory'] instanceof BagOStuff ) ? $params['writeFactory'] - : ObjectFactory::getObjectFromSpec( $params['writeFactory'] ); + : ObjectFactory::getObjectFromSpec( $opts + $params['writeFactory'] ); $this->readStore = ( $params['readFactory'] instanceof BagOStuff ) ? $params['readFactory'] - : ObjectFactory::getObjectFromSpec( $params['readFactory'] ); + : ObjectFactory::getObjectFromSpec( $opts + $params['readFactory'] ); + $this->attrMap = $this->mergeFlagMaps( [ $this->readStore, $this->writeStore ] ); } public function setDebug( $debug ) { @@ -112,7 +114,7 @@ class ReplicatedBagOStuff extends BagOStuff { return $this->writeStore->unlock( $key ); } - public function merge( $key, $callback, $exptime = 0, $attempts = 10, $flags = 0 ) { + public function merge( $key, callable $callback, $exptime = 0, $attempts = 10, $flags = 0 ) { return $this->writeStore->merge( $key, $callback, $exptime, $attempts, $flags ); }