Merge "[JobQueue] Cross-wiki queue access cleanups."
[lhc/web/wiklou.git] / includes / objectcache / MultiWriteBagOStuff.php
index 2f37c23..4120749 100644 (file)
@@ -61,9 +61,10 @@ class MultiWriteBagOStuff extends BagOStuff {
 
        /**
         * @param $key string
+        * @param $casToken[optional] mixed
         * @return bool|mixed
         */
-       public function get( $key ) {
+       public function get( $key, &$casToken = null ) {
                foreach ( $this->caches as $cache ) {
                        $value = $cache->get( $key );
                        if ( $value !== false ) {
@@ -73,6 +74,17 @@ class MultiWriteBagOStuff extends BagOStuff {
                return false;
        }
 
+       /**
+        * @param $casToken mixed
+        * @param $key string
+        * @param $value mixed
+        * @param $exptime int
+        * @return bool
+        */
+       public function cas( $casToken, $key, $value, $exptime = 0 ) {
+               throw new MWException( "CAS is not implemented in " . __CLASS__ );
+       }
+
        /**
         * @param $key string
         * @param $value mixed
@@ -156,6 +168,17 @@ class MultiWriteBagOStuff extends BagOStuff {
                }
        }
 
+       /**
+        * @param $key string
+        * @param $callback closure Callback method to be executed
+        * @param $exptime int Either an interval in seconds or a unix timestamp for expiry
+        * @param $attempts int 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 ) {
+               return $this->doWrite( 'merge', $key, $callback, $exptime );
+       }
+
        /**
         * @param $method string
         * @return bool