concurrent / org.apache.tuweni.concurrent / ExpiringSet

ExpiringSet

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.

Parameters

- The element type.

Constructors

<init>

ExpiringSet()

Construct an empty map.

Properties

size

val size: Int

Functions

add

fun add(element: E): Booleanfun 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.

addAll

fun addAll(elements: Collection<E>): Boolean

clear

fun clear(): Unit

contains

fun contains(element: E): Boolean

containsAll

fun containsAll(elements: Collection<E>): Boolean

equals

fun equals(other: Any?): Boolean

hashCode

fun hashCode(): Int

isEmpty

fun isEmpty(): Boolean

iterator

fun iterator(): MutableIterator<E>

purgeExpired

fun purgeExpired(): Long

Force immediate expiration of any key/value pairs that have reached their expiry.

remove

fun remove(element: E): Boolean

removeAll

fun removeAll(elements: Collection<E>): Boolean

retainAll

fun retainAll(elements: Collection<E>): Boolean

toArray

fun toArray(): Array<Any>
fun <T : Any> toArray(a: Array<T>): Array<T>