* 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 );
* @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;
}
* @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 );
}
* @return bool
*/
public function setMulti( array $data, $exptime = 0 ) {
- wfProfileIn( __METHOD__ );
foreach ( $data as $key => $value ) {
$encKey = $this->encodeKey( $key );
if ( $encKey !== $key ) {
}
$this->debugLog( 'setMulti(' . implode( ', ', array_keys( $data ) ) . ')' );
$result = $this->client->setMulti( $data, $this->fixExpiry( $exptime ) );
- wfProfileOut( __METHOD__ );
return $this->checkResult( false, $result );
}
}