-
public final class CachesKt
-
-
Method Summary
Modifier and Type Method Description final <T extends Any> TgetOrCache(Id<T> id, String type, Function0<T> valueProvider)Returns the value for specified id and type. final <T extends Any> TgetFromCache(Id<T> id, String type)Returns the value for specified id and type. final <T extends Any> UnitputInCache(Id<T> id, String type, T value)Adds in cache the specified value. final <T extends Any> UnitremoveFromCache(Id<T> id, String type)Remove the value for specified id and type from cache. final <T extends Any> Map<Id<T>, Object>getCachedValuesForType(String type)Returns all cached value for specified type. -
-
Method Detail
-
getOrCache
final <T extends Any> T getOrCache(Id<T> id, String type, Function0<T> valueProvider)
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.
-
getFromCache
final <T extends Any> T getFromCache(Id<T> id, String type)
Returns the value for specified id and type. If no value exists, null is returned.
-
putInCache
final <T extends Any> Unit putInCache(Id<T> id, String type, T value)
Adds in cache the specified value.
-
removeFromCache
final <T extends Any> Unit removeFromCache(Id<T> id, String type)
Remove the value for specified id and type from cache.
-
-
-
-