Merge "Ensure users are able to edit the page after changing the content model"
[lhc/web/wiklou.git] / includes / libs / objectcache / MemcachedBagOStuff.php
index 7a36214..6973392 100644 (file)
@@ -30,6 +30,12 @@ class MemcachedBagOStuff extends BagOStuff {
        /** @var MemcachedClient|Memcached */
        protected $client;
 
+       function __construct( array $params ) {
+               parent::__construct( $params );
+
+               $this->attrMap[self::ATTR_SYNCWRITES] = self::QOS_SYNCWRITES_BE; // unreliable
+       }
+
        /**
         * Fill in some defaults for missing keys in $params.
         *
@@ -75,14 +81,15 @@ class MemcachedBagOStuff extends BagOStuff {
                        $this->fixExpiry( $exptime ) );
        }
 
-       public function merge( $key, $callback, $exptime = 0, $attempts = 10, $flags = 0 ) {
-               if ( !is_callable( $callback ) ) {
-                       throw new Exception( "Got invalid callback." );
-               }
-
+       public function merge( $key, callable $callback, $exptime = 0, $attempts = 10, $flags = 0 ) {
                return $this->mergeViaCas( $key, $callback, $exptime, $attempts );
        }
 
+       public function changeTTL( $key, $exptime = 0 ) {
+               return $this->client->touch( $this->validateKeyEncoding( $key ),
+                       $this->fixExpiry( $exptime ) );
+       }
+
        /**
         * Get the underlying client object. This is provided for debugging
         * purposes.