$redis = Redis::connection();
$key = 'goods_'.$id;
// $element = null;
$options = array(
'cas' => true,
'watch' => $key,
'retry' => 3,
);
$redis->transaction($options, function ($tx) use ($key, &$element) {
$tx->multi();
$tx->incrby($key, -1);
});
<span style="white-space:pre"> </span>//异步队列修改库存和订单TODO