class ExpiringSet<E : Any> : MutableSet<E>
(source)
A concurrent hash set that stores values along with an expiry. Elements are stored in the set until their expiry is reached, after which they will no longer be available and will appear as if removed. The actual removal is done lazily whenever the set is accessed, or when the #purgeExpired()
method is invoked.
ExpiringSet()
Construct an empty map. |
val size: Int |
fun add(element: E): Boolean fun add(element: E, expiry: Long): Boolean fun add(element: E, expiry: Long, expiryListener: Consumer<E>?): Boolean
Adds the specified element to this set if it is not already present, and expires the entry when the specified expiry time is reached. |
|
fun addAll(elements: Collection<E>): Boolean |
|
fun clear(): Unit |
|
fun contains(element: E): Boolean |
|
fun containsAll(elements: Collection<E>): Boolean |
|
fun equals(other: Any?): Boolean |
|
fun hashCode(): Int |
|
fun isEmpty(): Boolean |
|
fun iterator(): MutableIterator<E> |
|
fun purgeExpired(): Long
Force immediate expiration of any key/value pairs that have reached their expiry. |
|
fun remove(element: E): Boolean |
|
fun removeAll(elements: Collection<E>): Boolean |
|
fun retainAll(elements: Collection<E>): Boolean |
|
fun toArray(): Array<Any> fun <T : Any> toArray(a: Array<T>): Array<T> |