tuweni / 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.

Constructors

<init>

Construct an empty expiring set.

ExpiringSet(evictionTimeout: Long)

Construct an empty set.

ExpiringSet()

Properties

size

val size: Int

Functions

add

fun add(element: 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 add(element: E, expiry: Long): Boolean
fun add(element: E, expiry: Long, expiryListener: Consumer<E>?): Boolean

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

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

fun purgeExpired(): Long

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>!