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