put

suspend fun <T : Any> DataCache.put(type: KType, item: T): Unit?
inline suspend fun <T : Any> DataCache.put(item: T): Unit?

Inserts a new item into the cache. Inserting an entry with an id that is already present will cause the old value to be overwritten.


inline suspend fun <VALUE : Any> DataCache.put(items: Iterable<VALUE>, ttl: Duration): Unit?
inline suspend fun <VALUE : Any> DataCache.put(items: Flow<VALUE>, ttl: Duration): Unit?

Inserts new expiring items into the cache for ttl. Inserting an entry with an id that is already present will cause the old value to be overwritten.


inline suspend fun <VALUE : Any> DataCache.put(items: Iterable<VALUE>, until: Instant, clock: Clock = Clock.System): Unit?
inline suspend fun <VALUE : Any> DataCache.put(items: Flow<VALUE>, until: Instant, clock: Clock = Clock.System): Unit?

Inserts new items into the cache until it expires. Inserting an entry with an id that is already present will cause the old value to be overwritten.

Parameters

clock

the Clock to use to look up the current time

Throws