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-2017 Software AG, Darmstadt, Germany.

Product LogoContact Support   |   Community   |   Feedback