深入理解Ehcache系列(二)
CacheManager是Ehcache的缓存主要管理类.支持单例模式和工厂模式. 主要用于管理Ehcache里面有的Cache. 可以使用CacheManager来创建Cache. 如: CacheManager manager = CacheManager.newInstance("src/config/cache.xml"); manager.addCache("testCache"); Cache cache = singletonManager.getCache("testCache"); manager.removeCache("testCache"); 具体实现如下: 单例模式: /** * The Singleton Instance. */ private static volatile CacheManager singleton; /** * A factory method to create a singleton CacheManager with default config, or return it if it exists. * <p/> * The configuration will be read, {@link Ehcache}s created and required stores initialized. When the {