Class GlobalCacheManager


  • public class GlobalCacheManager
    extends Object
    • Constructor Detail

      • GlobalCacheManager

        public GlobalCacheManager()
    • Method Detail

      • init

        public static void init()
      • initCache

        public static <K,​V> void initCache​(String alias,
                                                 Class<K> keyType,
                                                 Class<V> valueType,
                                                 Supplier<org.ehcache.config.CacheConfiguration<K,​V>> configBuilder)
      • getInstanceCache

        public static <K,​V> org.ehcache.Cache<K,​V> getInstanceCache​(String alias,
                                                                                Class<K> keyType,
                                                                                Class<V> valueType,
                                                                                Supplier<org.ehcache.config.CacheConfiguration<K,​V>> configBuilder)
        Returns the cache with the given name. When the cache does not exist, a new cache is created.
        Type Parameters:
        K - Type of the cache key.
        V - Type of the cached values.
        Parameters:
        alias - Name of the cache.
        keyType - Type of the cache key.
        valueType - Type of the cached values.
        configBuilder - Supplier that is called when no cache exists and a new cache needs to be created. It should return the configuration for the new cache.
        Returns:
        The newly created cache, null when the cache could not be created.
      • reinitCache

        public static <K,​V> org.ehcache.Cache<K,​V> reinitCache​(String alias,
                                                                           Class<K> keyType,
                                                                           Class<V> valueType,
                                                                           Supplier<org.ehcache.config.CacheConfiguration<K,​V>> configBuilder)
        Reinitializes the cache with the given name. Shuts down the cache if present and recreates it.
        Type Parameters:
        K - Type of the cache key.
        V - Type of the cached values.
        Parameters:
        alias - Name of the cache.
        keyType - Type of the cache key.
        valueType - Type of the cached values.
        configBuilder - Supplier that should return the configuration for the new cache.
        Returns:
        The newly created cache, null when the cache could not be created.
      • shutdownCache

        public static void shutdownCache​(String alias)
        Shuts down the given with the given name.
        Parameters:
        alias - Name of the cache to shut down.
      • getInstance

        public static org.ehcache.CacheManager getInstance()
        Gets the cacheManager
        Returns:
        the cacheManager
      • shutdown

        public static void shutdown()
        Removes all EH caches.
      • reinit

        public static void reinit()
        Reinitialize cache after configuration change