Design an algorithm to efficiently detect duplicate messages in a high-throughput chat stream within a sliding time window at Twitch.