tock / ai.tock.shared.cache

Package ai.tock.shared.cache

Internal cache utilities

Functions

getCachedValuesForType

Returns all cached value for specified type.

fun <T> getCachedValuesForType(type: String): Map<Id<T>, Any>

getFromCache

Returns the value for specified id and type. If no value exists, null is returned.

fun <T : Any> getFromCache(id: Id<T>, type: String): T?

getOrCache

Returns the value for specified id and type. If no value exists, valueProvider provides the value to cache. If valueProvider throws exception or returns null, no value is cached and null is returned.

fun <T : Any> getOrCache(id: Id<T>, type: String, valueProvider: () -> T?): T?

putInCache

Adds in cache the specified value.

fun <T : Any> putInCache(id: Id<T>, type: String, value: T): Unit

removeFromCache

Remove the value for specified id and type from cache.

fun <T : Any> removeFromCache(id: Id<T>, type: String): Unit