BigMemory 4.3.8 | Product Documentation | BigMemory Max Developer Guide | Basic Caching | Creating a CacheManager
 
Creating a CacheManager
All usages of the Ehcache API start with the creation of a CacheManager. The following code snippets illustrate various ways to create one.
Singleton versus Instance
The following creates a singleton CacheManager using defaults, then list caches.
CacheManager.create();
String[] cacheNames = CacheManager.getInstance().getCacheNames();
The following creates a CacheManager instance using defaults, then list caches.
CacheManager.newInstance();
String[] cacheNames = manager.getCacheNames();
The following creates two CacheManagers, each with a different configuration, and list the caches in each.
CacheManager manager1 = CacheManager.newInstance("src/config/ehcache1.xml");
CacheManager manager2 = CacheManager.newInstance("src/config/ehcache2.xml");
String[] cacheNamesForManager1 = manager1.getCacheNames();
String[] cacheNamesForManager2 = manager2.getCacheNames();