Turn off duplicate key gets for ReplicatedBagOStuff
[lhc/web/wiklou.git] / includes / libs / objectcache / ReplicatedBagOStuff.php
index b98c982..f8dba96 100644 (file)
@@ -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 ) {
@@ -84,8 +86,8 @@ class ReplicatedBagOStuff extends BagOStuff {
                        : $this->readStore->getMulti( $keys, $flags );
        }
 
-       public function set( $key, $value, $exptime = 0 ) {
-               return $this->writeStore->set( $key, $value, $exptime );
+       public function set( $key, $value, $exptime = 0, $flags = 0 ) {
+               return $this->writeStore->set( $key, $value, $exptime, $flags );
        }
 
        public function delete( $key ) {
@@ -112,8 +114,8 @@ class ReplicatedBagOStuff extends BagOStuff {
                return $this->writeStore->unlock( $key );
        }
 
-       public function merge( $key, $callback, $exptime = 0, $attempts = 10 ) {
-               return $this->writeStore->merge( $key, $callback, $exptime, $attempts );
+       public function merge( $key, callable $callback, $exptime = 0, $attempts = 10, $flags = 0 ) {
+               return $this->writeStore->merge( $key, $callback, $exptime, $attempts, $flags );
        }
 
        public function getLastError() {