* - serializer: May be either "php" or "igbinary". Igbinary produces more compact
* values, but serialization is much slower unless the php.ini option
* igbinary.compact_strings is off.
+ * @param array $params
*/
function __construct( $params ) {
$params = $this->applyDefaultParams( $params );
}
/**
- * @param $key string
- * @param $casToken[optional] float
- * @return Mixed
+ * @param string $key
+ * @param float $casToken [optional]
+ * @return mixed
*/
public function get( $key, &$casToken = null ) {
wfProfileIn( __METHOD__ );
}
/**
- * @param $key string
- * @param $value
- * @param $exptime int
+ * @param string $key
+ * @param mixed $value
+ * @param int $exptime
* @return bool
*/
public function set( $key, $value, $exptime = 0 ) {
}
/**
- * @param $casToken float
- * @param $key string
- * @param $value
- * @param $exptime int
+ * @param float $casToken
+ * @param string $key
+ * @param mixed $value
+ * @param int $exptime
* @return bool
*/
public function cas( $casToken, $key, $value, $exptime = 0 ) {
}
/**
- * @param $key string
- * @param $time int
+ * @param string $key
+ * @param int $time
* @return bool
*/
public function delete( $key, $time = 0 ) {
}
/**
- * @param $key string
- * @param $value int
- * @param $exptime int
- * @return Mixed
+ * @param string $key
+ * @param int $value
+ * @param int $exptime
+ * @return mixed
*/
public function add( $key, $value, $exptime = 0 ) {
$this->debugLog( "add($key)" );
}
/**
- * @param $key string
- * @param $value int
- * @param $exptime
- * @return Mixed
- */
- public function replace( $key, $value, $exptime = 0 ) {
- $this->debugLog( "replace($key)" );
- return $this->checkResult( $key, parent::replace( $key, $value, $exptime ) );
- }
-
- /**
- * @param $key string
- * @param $value int
- * @return Mixed
+ * @param string $key
+ * @param int $value
+ * @return mixed
*/
public function incr( $key, $value = 1 ) {
$this->debugLog( "incr($key)" );
}
/**
- * @param $key string
- * @param $value int
- * @return Mixed
+ * @param string $key
+ * @param int $value
+ * @return mixed
*/
public function decr( $key, $value = 1 ) {
$this->debugLog( "decr($key)" );
* different.
*
* @param string $key The key used by the caller, or false if there wasn't one.
- * @param $result Mixed The return value
- * @return Mixed
+ * @param mixed $result The return value
+ * @return mixed
*/
protected function checkResult( $key, $result ) {
if ( $result !== false ) {
$msg = "Memcached error: $msg";
}
wfDebugLog( 'memcached-serious', $msg );
+ $this->setLastError( BagOStuff::ERR_UNEXPECTED );
}
return $result;
}
/**
- * @param $keys Array
- * @return Array
+ * @param array $keys
+ * @return array
*/
public function getMulti( array $keys ) {
wfProfileIn( __METHOD__ );
return $this->checkResult( false, $result );
}
+ /**
+ * @param array $data
+ * @param int $exptime
+ * @return bool
+ */
+ public function setMulti( array $data, $exptime = 0 ) {
+ wfProfileIn( __METHOD__ );
+ foreach ( $data as $key => $value ) {
+ $encKey = $this->encodeKey( $key );
+ if ( $encKey !== $key ) {
+ $data[$encKey] = $value;
+ unset( $data[$key] );
+ }
+ }
+ $this->debugLog( 'setMulti(' . implode( ', ', array_keys( $data ) ) . ')' );
+ $result = $this->client->setMulti( $data, $this->fixExpiry( $exptime ) );
+ wfProfileOut( __METHOD__ );
+ return $this->checkResult( false, $result );
+ }
+
+
/* NOTE: there is no cas() method here because it is currently not supported
* by the BagOStuff interface and other BagOStuff subclasses, such as
* SqlBagOStuff.