LazyCache

class LazyCache<T : Any>(val initializer: () -> T) : SingleObjectCache<T>

A cache that behaves like a resettable Lazy: It generates a value from a given initializer lazily, however that cache can be cleared, so that the value will be regenerated when queried next

Constructors

Link copied to clipboard
constructor(initializer: () -> T)

Properties

Link copied to clipboard
val initializer: () -> T
Link copied to clipboard
open override val value: T

Functions

Link copied to clipboard
open override fun clear()
Link copied to clipboard
open fun clearOn(shouldClear: () -> Boolean): SingleObjectCache<T>

Creates a new cache, that wraps the old cache and automatically calls @see clear before retrieving a value if shouldClear returns true