replaceSSEInCache method

void replaceSSEInCache(
  1. bool fromHit(
    1. ServerSentEventCache element
    ),
  2. ServerSentEvent toEvent
)

Very rare usage scenario, for example i want to replace some scatter sse to one gathered sse. This function support the story : https://pm.ifitu.co/issues/19143 fromHit is function to remove when match the rule, according return result, true will be delete. toEvent will be insert to sse cache head of SSECacheDeliverer

Implementation

void replaceSSEInCache(
    bool Function(ServerSentEventCache element) fromHit, ServerSentEvent toEvent) {
  if (toEvent.isIllegal()) {
    slog.df("resolve event illegal : $toEvent", tag: tag);
    return;
  }
  slog.df("replace sse cache : $toEvent", tag: tag);
  _sseCacheDeliverer.replace(fromHit, toEvent);
  _sseCacheDeliverer.flush(pop: _deliverSSEC);
}