addIfNotPresent

open override fun <T> addIfNotPresent(key: Key<T>, value: T?)

Add value for given key if not already present.

This is semmantically same as

if(!exists(key)) add(key, value) *

Parameters

key
value

open suspend override fun <T> addIfNotPresent(key: Key<T>, value: T?, timeout: Long?)

Same as addIfNotPresent in ApplicationContext with additional timeout parameter for wait time in case of multiple threads blocking on this method

Parameters

key
value
timeout

in millis