Made BagOStuff::cas properly optional
[lhc/web/wiklou.git] / includes / objectcache / SqlBagOStuff.php
index 03b0166..df878f7 100644 (file)
@@ -405,7 +405,7 @@ class SqlBagOStuff extends BagOStuff {
         * @param int $exptime
         * @return bool
         */
-       public function cas( $casToken, $key, $value, $exptime = 0 ) {
+       protected function cas( $casToken, $key, $value, $exptime = 0 ) {
                list( $serverIndex, $tableName ) = $this->getTableByKey( $key );
                try {
                        $db = $this->getDB( $serverIndex );
@@ -514,6 +514,14 @@ class SqlBagOStuff extends BagOStuff {
                return $newValue;
        }
 
+       public function merge( $key, $callback, $exptime = 0, $attempts = 10 ) {
+               if ( !is_callable( $callback ) ) {
+                       throw new Exception( "Got invalid callback." );
+               }
+
+               return $this->mergeViaCas( $key, $callback, $exptime, $attempts );
+       }
+
        /**
         * @param DatabaseBase $db
         * @param string $exptime