* the PHP memcached client.
*
* backends for local hash array and SQL table included:
- * <code>
+ * @code
* $bag = new HashBagOStuff();
* $bag = new SqlBagOStuff(); # connect to db first
- * </code>
+ * @endcode
*
* @ingroup Cache
*/
* @param int $exptime Either an interval in seconds or a unix timestamp for expiry
* @param int $attempts The amount of times to attempt a merge in case of failure
* @return bool Success
+ * @throws InvalidArgumentException
*/
public function merge( $key, $callback, $exptime = 0, $attempts = 10 ) {
if ( !is_callable( $callback ) ) {
- throw new Exception( "Got invalid callback." );
+ throw new InvalidArgumentException( "Got invalid callback." );
}
return $this->mergeViaLock( $key, $callback, $exptime, $attempts );
* @param mixed $value
* @param int $exptime Either an interval in seconds or a unix timestamp for expiry
* @return bool Success
+ * @throws Exception
*/
protected function cas( $casToken, $key, $value, $exptime = 0 ) {
throw new Exception( "CAS is not implemented in " . __CLASS__ );
/**
* @param string $key
- * @param int $timeout Lock wait timeout [optional]
+ * @param int $timeout Lock wait timeout; 0 for non-blocking [optional]
* @param int $expiry Lock expiry [optional]
* @return bool Success
*/
$this->lastError = $err;
}
+ /**
+ * Modify a cache update operation array for EventRelayer::notify()
+ *
+ * This is used for relayed writes, e.g. for broadcasting a change
+ * to multiple data-centers. If the array contains a 'val' field
+ * then the command involves setting a key to that value. Note that
+ * for simplicity, 'val' is always a simple scalar value. This method
+ * is used to possibly serialize the value and add any cache-specific
+ * key/values needed for the relayer daemon (e.g. memcached flags).
+ *
+ * @param array $event
+ * @return array
+ * @since 1.26
+ */
+ public function modifySimpleRelayEvent( array $event ) {
+ return $event;
+ }
+
/**
* @param string $text
*/