BigMemory Max 4.3.4 | Product Documentation | BigMemory Max Developer Guide | Basic Caching | Loading a Configuration
 
Loading a Configuration
When a CacheManager is created, it creates caches found in a provided configuration.
The following creates a CacheManager based on the configuration defined in the ehcache.xml file in the classpath.
CacheManager manager = CacheManager.newInstance();
The following creates a CacheManager based on a specified configuration file.
CacheManager manager = CacheManager.newInstance("src/config/ehcache.xml");
The following creates a CacheManager from a configuration resource in the classpath.
URL url = getClass().getResource("/anotherconfigurationname.xml");
CacheManager manager = CacheManager.newInstance(url);
The following creates a CacheManager from a configuration in an InputStream.
InputStream fis = new FileInputStream(new File
("src/config/ehcache.xml").getAbsolutePath());
try {
CacheManager manager = CacheManager.newInstance(fis);
} finally {
fis.close();
}

Copyright © 2010 - 2019 | Software AG, Darmstadt, Germany and/or Software AG USA, Inc., Reston, VA, USA, and/or its subsidiaries and/or its affiliates and/or their licensors.