BigMemory Go 4.3.6 | Product Documentation | BigMemory Go 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();

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.
Innovation Release