This message was deleted.
# configuration-cache
s
This message was deleted.
v
It is evaluated each time you request its value if you don't cache the calculation, that is by design afaik.
t
I suspected that
v
I could suggest you a mitigation, just have to remember in which project I did it
Ah, found it
Copy code
inline fun <reified T> cachedProvider(crossinline block: () -> T): Provider<T> =
    objects
        .property<T>()
        .value(provider { block() })
        .apply {
            disallowChanges()
            finalizeValueOnRead()
        }
t
I suppose trick is in
finalizeValueOnRead()
?
v
If with "trick" you mean the caching, yes.
thank you 1
Unfortunately
Provider
does not have that method, thus the detour over an unmodifiable (
disallowChanges()
)
Property