Class EhCacheManagerUtils

    • Method Detail

      • buildCacheManager

        public static CacheManager buildCacheManager()
                                              throws CacheException
        Build an EhCache CacheManager from the default configuration.

        The CacheManager will be configured from "ehcache.xml" in the root of the class path (that is, default EhCache initialization - as defined in the EhCache docs - will apply). If no configuration file can be found, a fail-safe fallback configuration will be used.

        Returns:
        the new EhCache CacheManager
        Throws:
        CacheException - in case of configuration parsing failure
      • buildCacheManager

        public static CacheManager buildCacheManager​(String name)
                                              throws CacheException
        Build an EhCache CacheManager from the default configuration.

        The CacheManager will be configured from "ehcache.xml" in the root of the class path (that is, default EhCache initialization - as defined in the EhCache docs - will apply). If no configuration file can be found, a fail-safe fallback configuration will be used.

        Parameters:
        name - the desired name of the cache manager
        Returns:
        the new EhCache CacheManager
        Throws:
        CacheException - in case of configuration parsing failure
      • buildCacheManager

        public static CacheManager buildCacheManager​(String name,
                                                     Resource configLocation)
                                              throws CacheException
        Build an EhCache CacheManager from the given configuration resource.
        Parameters:
        name - the desired name of the cache manager
        configLocation - the location of the configuration file (as a Spring resource)
        Returns:
        the new EhCache CacheManager
        Throws:
        CacheException - in case of configuration parsing failure