Merge "Use User::equals() where applicable in the class"
[lhc/web/wiklou.git] / includes / libs / objectcache / ReplicatedBagOStuff.php
index a263a3d..9e80e9f 100644 (file)
@@ -53,7 +53,8 @@ class ReplicatedBagOStuff extends BagOStuff {
                if ( !isset( $params['writeFactory'] ) ) {
                        throw new InvalidArgumentException(
                                __METHOD__ . ': the "writeFactory" parameter is required' );
-               } elseif ( !isset( $params['readFactory'] ) ) {
+               }
+               if ( !isset( $params['readFactory'] ) ) {
                        throw new InvalidArgumentException(
                                __METHOD__ . ': the "readFactory" parameter is required' );
                }
@@ -71,12 +72,16 @@ class ReplicatedBagOStuff extends BagOStuff {
                $this->readStore->setDebug( $debug );
        }
 
-       public function get( $key, &$casToken = null ) {
-               return $this->readStore->get( $key, $casToken );
+       public function get( $key, &$casToken = null, $flags = 0 ) {
+               return ( $flags & self::READ_LATEST )
+                       ? $this->writeStore->get( $key, $casToken, $flags )
+                       : $this->readStore->get( $key, $casToken, $flags );
        }
 
-       public function getMulti( $keys ) {
-               return $this->readStore->getMulti( $keys );
+       public function getMulti( array $keys, $flags = 0 ) {
+               return ( $flags & self::READ_LATEST )
+                       ? $this->writeStore->getMulti( $keys, $flags )
+                       : $this->readStore->getMulti( $keys, $flags );
        }
 
        public function set( $key, $value, $exptime = 0 ) {
@@ -95,12 +100,12 @@ class ReplicatedBagOStuff extends BagOStuff {
                return $this->writeStore->incr( $key, $value );
        }
 
-       public function decr( $key ) {
-               return $this->writeStore->decr( $key );
+       public function decr( $key, $value = 1 ) {
+               return $this->writeStore->decr( $key, $value );
        }
 
-       public function lock( $key, $timeout = 6, $expiry = 6 ) {
-               return $this->writeStore->lock( $key, $timeout, $expiry );
+       public function lock( $key, $timeout = 6, $expiry = 6, $rclass = '' ) {
+               return $this->writeStore->lock( $key, $timeout, $expiry, $rclass );
        }
 
        public function unlock( $key ) {