(1)使用默认配置文件ehcache.xml创建
CacheManager manager=CacheManager.getInstance();
CacheManager manager=CacheManager.create();
(2)指定配置文件创建
CacheManager manager=CacheManager.create("/etc/config/chcache.xml");
(3)从Classpath寻找配置文件创建
URL url=getClass().getResource("/chcahce.xml");
CacheManager manager=CacheManager.create(url);
(4)通过输入流创建
InputStream fis=new FileInputStream(new File("/etc/config/chcache.xml").getAbsolutePath());
CacheManager manager=CacheManager.create(fis);