Merge "Cleaned up and split up Swift header parsing methods a bit"
[lhc/web/wiklou.git] / includes / objectcache / MultiWriteBagOStuff.php
index b5333fd..3a30f83 100644 (file)
@@ -40,12 +40,12 @@ class MultiWriteBagOStuff extends BagOStuff {
         *               the documentation of $wgObjectCaches for more detail.
         *
         * @param array $params
-        * @throws MWException
+        * @throws InvalidArgumentException
         */
        public function __construct( $params ) {
                parent::__construct( $params );
                if ( !isset( $params['caches'] ) ) {
-                       throw new MWException( __METHOD__ . ': the caches parameter is required' );
+                       throw new InvalidArgumentException( __METHOD__ . ': the caches parameter is required' );
                }
 
                $this->caches = array();
@@ -61,14 +61,9 @@ class MultiWriteBagOStuff extends BagOStuff {
                $this->doWrite( 'setDebug', $debug );
        }
 
-       /**
-        * @param string $key
-        * @param mixed $casToken [optional]
-        * @return bool|mixed
-        */
-       public function get( $key, &$casToken = null ) {
+       public function get( $key, &$casToken = null, $flags = 0 ) {
                foreach ( $this->caches as $cache ) {
-                       $value = $cache->get( $key );
+                       $value = $cache->get( $key, null, $flags = 0 );
                        if ( $value !== false ) {
                                return $value;
                        }
@@ -76,18 +71,6 @@ class MultiWriteBagOStuff extends BagOStuff {
                return false;
        }
 
-       /**
-        * @param mixed $casToken
-        * @param string $key
-        * @param mixed $value
-        * @param mixed $exptime
-        * @return bool
-        * @throws MWException
-        */
-       public function cas( $casToken, $key, $value, $exptime = 0 ) {
-               throw new MWException( "CAS is not implemented in " . __CLASS__ );
-       }
-
        /**
         * @param string $key
         * @param mixed $value
@@ -163,12 +146,12 @@ class MultiWriteBagOStuff extends BagOStuff {
 
        /**
         * @param string $key
-        * @param Closure $callback Callback method to be executed
+        * @param callable $callback Callback method to be executed
         * @param int $exptime Either an interval in seconds or a unix timestamp for expiry
         * @param int $attempts The amount of times to attempt a merge in case of failure
         * @return bool Success
         */
-       public function merge( $key, Closure $callback, $exptime = 0, $attempts = 10 ) {
+       public function merge( $key, $callback, $exptime = 0, $attempts = 10 ) {
                return $this->doWrite( 'merge', $key, $callback, $exptime );
        }