vertx / io.vertx.kotlin.core.shareddata / io.vertx.core.shareddata.AsyncMap / putIfAbsentAwait

putIfAbsentAwait

suspend fun <K, V> AsyncMap<K, V>.putIfAbsentAwait(k: K, v: V): V?

Put the entry only if there is no entry with the key already present. If key already present then the existing value will be returned to the handler, otherwise null.

Parameters

k - the key

v - the value

completionHandler - the handler

suspend fun <K, V> AsyncMap<K, V>.putIfAbsentAwait(k: K, v: V, ttl: Long): V?

Link io.vertx.core.shareddata.AsyncMap but specifying a time to live for the entry. Entry will expire and get evicted after the ttl.

Parameters

k - the key

v - the value

ttl - The time to live (in ms) for the entry

completionHandler - the handler