Class CachesKt

  • All Implemented Interfaces:

    
    public final class CachesKt
    
                        
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Field Summary

      Fields 
      Modifier and Type Field Description
    • Constructor Summary

      Constructors 
      Constructor Description
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Method Summary

      Modifier and Type Method Description
      final static <T extends Any> T getOrCache(Id<T> id, String type, Function0<T> valueProvider) Returns the value for specified id and type.
      final static <T extends Any> T getFromCache(Id<T> id, String type) Returns the value for specified id and type.
      final static <T extends Any> Unit putInCache(Id<T> id, String type, T value) Adds in cache the specified value.
      final static <T extends Any> Unit removeFromCache(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.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

    • 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.