Class CacheFactory

java.lang.Object
com.github.benmanes.caffeine.jcache.CacheFactory

final class CacheFactory extends Object
A factory for creating a cache from the configuration.
  • Constructor Details

    • CacheFactory

      private CacheFactory()
  • Method Details

    • isDefinedExternally

      public static boolean isDefinedExternally(String cacheName)
      Returns a if the cache definition is found in the external settings file.
      Parameters:
      cacheName - the name of the cache
      Returns:
      true if a definition exists
    • tryToCreateFromExternalSettings

      public static <K, V> @Nullable CacheProxy<K,V> tryToCreateFromExternalSettings(javax.cache.CacheManager cacheManager, String cacheName)
      Returns a newly created cache instance if a definition is found in the external settings file.
      Parameters:
      cacheManager - the owner of the cache instance
      cacheName - the name of the cache
      Returns:
      a new cache instance or null if the named cache is not defined in the settings file
    • createCache

      public static <K, V> CacheProxy<K,V> createCache(javax.cache.CacheManager cacheManager, String cacheName, javax.cache.configuration.Configuration<K,V> configuration)
      Returns a fully constructed cache based on the cache
      Parameters:
      cacheManager - the owner of the cache instance
      cacheName - the name of the cache
      configuration - the full cache definition
      Returns:
      a newly constructed cache instance
    • rootConfig

      private static com.typesafe.config.Config rootConfig()
      Returns the resolved configuration.
    • resolveConfigurationFor

      private static <K, V> CaffeineConfiguration<K,V> resolveConfigurationFor(javax.cache.configuration.Configuration<K,V> configuration)
      Copies the configuration and overlays it on top of the default settings.