use of net.sf.ehcache.CacheManager in project gocd by gocd.
the class UserCacheFactory method createCacheManager.
private CacheManager createCacheManager() {
Configuration configuration = new Configuration();
configuration.setDefaultCacheConfiguration(new CacheConfiguration("cache", 10000));
return new CacheManager(configuration);
}
use of net.sf.ehcache.CacheManager in project cxf by apache.
the class EHCacheUtils method getCacheManager.
public static CacheManager getCacheManager(Bus bus, URL configFileURL) {
CacheManager cacheManager = null;
String globalCacheManagerName = getGlobalCacheManagerName(bus);
if (globalCacheManagerName != null) {
cacheManager = CacheManager.getCacheManager(globalCacheManagerName);
}
if (cacheManager == null) {
String confName = "";
if (bus != null) {
confName = bus.getId();
}
cacheManager = EHCacheManagerHolder.getCacheManager(confName, configFileURL);
}
return cacheManager;
}
use of net.sf.ehcache.CacheManager in project oc-explorer by devgateway.
the class MarkupCacheService method clearReportsApiCache.
/**
* Remove from cache all reports api content
*/
public void clearReportsApiCache() {
CacheManager cm = CacheManager.getInstance();
// get the reports cache "reportsApiCache", declared in ehcache.xml
Cache cache = cm.getCache("reportsApiCache");
if (cache != null) {
cache.removeAll();
}
// get the reports cache "excelExportCache", declared in ehcache.xml
Cache excelExportCache = cm.getCache("excelExportCache");
if (excelExportCache != null) {
excelExportCache.removeAll();
}
}
use of net.sf.ehcache.CacheManager in project cxf by apache.
the class EHCacheUtilsTest method testUseGlobalManager.
@Test
public void testUseGlobalManager() {
Bus bus = BusFactory.getThreadDefaultBus();
Configuration conf = ConfigurationFactory.parseConfiguration(EHCacheManagerHolder.class.getResource("/cxf-test-ehcache.xml"));
conf.setName("myGlobalConfig");
CacheManager.newInstance(conf);
CacheManager manager = EHCacheUtils.getCacheManager(bus, EHCacheManagerHolder.class.getResource("/cxf-test-ehcache.xml"));
assertFalse(manager.getName().equals("myGlobalConfig"));
EHCacheManagerHolder.releaseCacheManger(manager);
assertEquals(Status.STATUS_SHUTDOWN, manager.getStatus());
bus.setProperty(EHCacheUtils.GLOBAL_EHCACHE_MANAGER_NAME, "myGlobalConfig");
manager = EHCacheUtils.getCacheManager(bus, EHCacheManagerHolder.class.getResource("/cxf-test-ehcache.xml"));
assertEquals("myGlobalConfig", manager.getName());
EHCacheManagerHolder.releaseCacheManger(manager);
assertEquals(Status.STATUS_ALIVE, manager.getStatus());
manager.shutdown();
assertEquals(Status.STATUS_SHUTDOWN, manager.getStatus());
bus.setProperty(EHCacheUtils.GLOBAL_EHCACHE_MANAGER_NAME, "myGlobalConfigXXX");
manager = EHCacheUtils.getCacheManager(bus, EHCacheManagerHolder.class.getResource("/cxf-test-ehcache.xml"));
assertFalse(manager.getName().equals("myGlobalConfig"));
EHCacheManagerHolder.releaseCacheManger(manager);
assertEquals(Status.STATUS_SHUTDOWN, manager.getStatus());
}
Aggregations