MessageDeduplicationCache
class MessageDeduplicationCache(cacheSize: Int, logger: Logger, description: String, clock: () -> Long = System::currentTimeMillis)(source)
Remembers recently seen message IDs so a message relayed back to its origin server is dropped instead of echoed.
Entries expire after CLEANUP_THRESHOLD_MILLIS; if the cache is still over cacheSize after that, the oldest entries go too. Entries are kept in the order they were recorded, so eviction only ever looks at the oldest end and costs O(1) amortized per recorded message.
Parameters
cacheSize
Soft upper bound on retained entries
logger
Where cleanup failures are reported
description
Names this cache in log output
clock
Source of the timestamps used for expiry