tuweni / org.apache.tuweni.concurrent / ExpiringMap / put

put

@Nullable fun put(key: K, value: V): V? (source) @Nullable fun put(key: K, value: V, expiry: Long): V? (source)

Associates the specified value with the specified key in this map, and expires the entry when the specified expiry time is reached. If the map previously contained a mapping for the key, the old value is replaced by the specified value.

Parameters

key - The key with which the specified value is to be associated.

value - The value to be associated with the specified key.

expiry - The expiry time for the value, in milliseconds since the epoch.

Return
The previous value associated with key, or null if there was no mapping for key.

@Nullable fun put(key: K, value: V, expiry: Long, @Nullable expiryListener: BiConsumer<K, V>?): V? (source)

Associates the specified value with the specified key in this map, and expires the entry when the specified expiry time is reached. If the map previously contained a mapping for the key, the old value is replaced by the specified value.

Parameters

key - The key with which the specified value is to be associated.

value - The value to be associated with the specified key.

expiry - The expiry time for the value, in milliseconds since the epoch.

expiryListener - A listener that will be invoked when the entry expires.

Return
The previous value associated with key, or null if there was no mapping for key.