Merge "mediawiki.action.edit.stash: set timeout to 4 seconds"
[lhc/web/wiklou.git] / includes / objectcache / MemcachedPeclBagOStuff.php
index 8700c8c..7c0a645 100644 (file)
@@ -43,6 +43,7 @@ class MemcachedPeclBagOStuff extends MemcachedBagOStuff {
         *                          values, but serialization is much slower unless the php.ini option
         *                          igbinary.compact_strings is off.
         * @param array $params
+        * @throws MWException
         */
        function __construct( $params ) {
                $params = $this->applyDefaultParams( $params );
@@ -119,11 +120,9 @@ class MemcachedPeclBagOStuff extends MemcachedBagOStuff {
         * @return mixed
         */
        public function get( $key, &$casToken = null ) {
-               wfProfileIn( __METHOD__ );
                $this->debugLog( "get($key)" );
                $result = $this->client->get( $this->encodeKey( $key ), null, $casToken );
                $result = $this->checkResult( $key, $result );
-               wfProfileOut( __METHOD__ );
                return $result;
        }
 
@@ -242,11 +241,10 @@ class MemcachedPeclBagOStuff extends MemcachedBagOStuff {
         * @return array
         */
        public function getMulti( array $keys ) {
-               wfProfileIn( __METHOD__ );
                $this->debugLog( 'getMulti(' . implode( ', ', $keys ) . ')' );
                $callback = array( $this, 'encodeKey' );
                $result = $this->client->getMulti( array_map( $callback, $keys ) );
-               wfProfileOut( __METHOD__ );
+               $result = $result ?: array(); // must be an array
                return $this->checkResult( false, $result );
        }
 
@@ -256,7 +254,6 @@ class MemcachedPeclBagOStuff extends MemcachedBagOStuff {
         * @return bool
         */
        public function setMulti( array $data, $exptime = 0 ) {
-               wfProfileIn( __METHOD__ );
                foreach ( $data as $key => $value ) {
                        $encKey = $this->encodeKey( $key );
                        if ( $encKey !== $key ) {
@@ -266,7 +263,6 @@ class MemcachedPeclBagOStuff extends MemcachedBagOStuff {
                }
                $this->debugLog( 'setMulti(' . implode( ', ', array_keys( $data ) ) . ')' );
                $result = $this->client->setMulti( $data, $this->fixExpiry( $exptime ) );
-               wfProfileOut( __METHOD__ );
                return $this->checkResult( false, $result );
        }
 }