commonMain.com.steamstreet.MutableLazy.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of awskt-standards-jvm Show documentation
Show all versions of awskt-standards-jvm Show documentation
Standard constructs and functions for working with AWS in Kotlin.
package com.steamstreet
import kotlin.properties.ReadWriteProperty
import kotlin.time.Duration
internal object UninitializedValue
//public expect class MutableLazy(timeout: Duration? = null, initializer: () -> T) : ReadWriteProperty
/**
* A version of the lazy delegate that also allows the value to be set at any point.
*/
public fun mutableLazy(initializer: () -> T): ReadWriteProperty =
cached(Duration.INFINITE, initializer)
/**
* A lazy delegate with a timeout. Once duration has been met, the initializer will be called
* again.
*/
public expect fun cached(timeout: Duration, initializer: () -> T): ReadWriteProperty