ExpirationMap

@ApiStatus.Experimental
@ApiStatus.AvailableSince(value = "5.0.0")
interface ExpirationMap<K, V> : MutableMap<K, V>

The basic implementation of an expiring map.

Parameters

K

The key type in the map.

V

The value type in the map.

Functions

Link copied to clipboard
abstract fun clear()
Link copied to clipboard
open fun compute(p0: K, p1: BiFunction<in K, in V?, out V?>): V?
Link copied to clipboard
open fun computeIfAbsent(p0: K, p1: Function<in K, out V>): V
Link copied to clipboard
open fun computeIfPresent(p0: K, p1: BiFunction<in K, in V, out V?>): V?
Link copied to clipboard
abstract fun containsKey(key: K): Boolean
Link copied to clipboard
abstract fun containsValue(value: V): Boolean
Link copied to clipboard
open fun forEach(p0: BiConsumer<in K, in V>)
Link copied to clipboard
abstract operator fun get(key: K): V?
Link copied to clipboard
open fun getOrDefault(key: K, defaultValue: V): V
Link copied to clipboard
abstract fun isEmpty(): Boolean
Link copied to clipboard
open fun merge(p0: K, p1: V, p2: BiFunction<in V, in V, out V?>): V?
Link copied to clipboard
abstract fun put(key: K, value: V): V?

abstract fun put(key: K, value: V, expireIn: Duration): V?
abstract fun put(key: K, value: V, expireIn: Duration, onExpire: ExpirationMapCallback<K, V>?): V?

Inserts an entry into the map that will expire after expireIn amount of time has passed.

Link copied to clipboard
abstract fun putAll(from: Map<out K, V>)
Link copied to clipboard
open fun putIfAbsent(p0: K, p1: V): V?
Link copied to clipboard
abstract fun remainingTime(key: K): Duration?

Provides the remaining time of until the element's expiration

Link copied to clipboard
abstract fun remove(key: K): V?
open fun remove(key: K, value: V): Boolean
Link copied to clipboard
open fun replace(p0: K, p1: V): V?
open fun replace(p0: K, p1: V, p2: V): Boolean
Link copied to clipboard
open fun replaceAll(p0: BiFunction<in K, in V, out V>)
Link copied to clipboard
abstract fun setExpiration(key: K, expireIn: Duration, onExpiration: ExpirationMapCallback<K, V>? = null): Boolean

Sets the element's expiration

Link copied to clipboard
abstract fun setExpirationCallback(key: K, onExpire: ExpirationMapCallback<K, V>?): Boolean

Sets the element's expiration callback, overriding any existing callback.

Properties

Link copied to clipboard
abstract override val entries: MutableSet<MutableMap.MutableEntry<K, V>>
Link copied to clipboard
abstract override val keys: MutableSet<K>
Link copied to clipboard
abstract val size: Int
Link copied to clipboard
abstract override val values: MutableCollection<V>

This MutableCollection will not reflect any changes made to the map.

Inheritors

Link copied to clipboard

Extensions

Link copied to clipboard
@API(status = API.Status.EXPERIMENTAL)
fun <K, V> MutableMap<K, V>.asObservable(): ObservableMap<K, V>
Link copied to clipboard
inline fun <K, V> MutableMap<K, V>.clear(crossinline onRemove: suspend (K, V) -> Unit)
Link copied to clipboard
inline fun <K, V> MutableMap<K, V>.computeAndRemove(key: K, crossinline onRemove: suspend V.() -> Unit): Boolean
Link copied to clipboard
inline fun Map<String, *>.contains(key: String, ignoreCase: Boolean = false): Boolean
Link copied to clipboard
inline fun <V> Map<String, V>.get(key: String, ignoreCase: Boolean = false): Option<V>
Link copied to clipboard
inline fun <T : Any, K> Map<K, *>.getCast(key: K): Option<T>