Build an in-memory event store with a plain map, then rework it for events that arrive out of order: keep them in a heap and apply a one-minute timeout.
Build an in-memory event store with a plain map, then rework it for events that arrive out of order: keep them in a heap and apply a one-minute timeout.
Opens with the full question.