/**
* Apply a write method to the first $count backing caches
*
- * @param integer $count
+ * @param int $count
* @param bool $asyncWrites
* @param string $method
- * @param mixed ...
+ * @param mixed $args,...
* @return bool
*/
protected function doWrite( $count, $asyncWrites, $method /*, ... */ ) {
$ret = true;
$args = array_slice( func_get_args(), 3 );
+ if ( $count > 1 && $asyncWrites ) {
+ // Deep-clone $args to prevent misbehavior when something writes an
+ // object to the BagOStuff then modifies it afterwards, e.g. T168040.
+ $args = unserialize( serialize( $args ) );
+ }
+
foreach ( $this->caches as $i => $cache ) {
if ( $i >= $count ) {
break; // ignore the lower tiers
return $ret;
}
+
+ public function makeKey() {
+ return call_user_func_array( [ $this->caches[0], __FUNCTION__ ], func_get_args() );
+ }
+
+ public function makeGlobalKey() {
+ return call_user_func_array( [ $this->caches[0], __FUNCTION__ ], func_get_args() );
+ }
}