put

open suspend override fun put(item: VALUE)

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.


abstract suspend fun put(item: VALUE, ttl: Duration?)

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

Parameters

ttl

the Duration after which the entry should expire or null for permanent items


open suspend fun put(item: VALUE, until: Instant, clock: Clock = Clock.System)

Inserts a new item 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


open suspend fun put(vararg items: VALUE, until: Instant, clock: Clock = Clock.System)
open suspend fun put(items: Iterable<VALUE>, until: Instant, clock: Clock = Clock.System)
open suspend fun put(items: Flow<VALUE>, until: Instant, clock: Clock = Clock.System)

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


open suspend fun put(vararg items: VALUE, ttl: Duration)
open suspend fun put(items: Iterable<VALUE>, ttl: Duration)
open suspend fun put(items: Flow<VALUE>, ttl: Duration)

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.