package at.hannibal2.skyhanni.utils import kotlin.time.Duration class TimeLimitedSet(expireAfterWrite: Duration) { private val cache = TimeLimitedCache(expireAfterWrite) fun add(element: T) = cache.put(element, Unit) operator fun contains(element: T): Boolean = cache.containsKey(element) fun clear() = cache.clear() fun toSet(): Set = cache.keys().toSet() }