CachedProperty
class CachedProperty<KEY : Any, VALUE>(val keyProperty: () -> KEY, lazy: Boolean = false, val factory: (KEY) -> VALUE) : ReadOnlyProperty<Any?, VALUE>
Caches a property value until a key changes.
Parameters
keyProperty
Function that provides the latest value of the cache key.
lazy
Whether to initialize the value immediately, or upon first invocation.
factory
Function to create the property value based on its current cache key.