use of net.sf.ehcache.config.CacheConfiguration in project gocd by gocd.
the class CacheInformationProvider method getCacheConfigurationInformationAsJson.
public Map<String, Object> getCacheConfigurationInformationAsJson() {
CacheConfiguration config = goCache.configuration();
LinkedHashMap<String, Object> json = new LinkedHashMap<>();
json.put("name", config.getName());
json.put("Maximum Elements in Memory", config.getMaxElementsInMemory());
json.put("Maximum Elements on Disk", config.getMaxElementsOnDisk());
json.put("Memory Store Eviction Policy", config.getMemoryStoreEvictionPolicy());
json.put("Clean or Flush", config.isClearOnFlush());
json.put("Eternal", config.isEternal());
json.put("Time To Idle Seconds", config.getTimeToIdleSeconds());
json.put("time To Live Seconds", config.getTimeToLiveSeconds());
json.put("Overflow To Disk", config.isOverflowToDisk());
json.put("Disk Persistent", config.isDiskPersistent());
json.put("Disk Store Path", config.getDiskStorePath());
json.put("Disk Spool Buffer Size in MB", config.getDiskSpoolBufferSizeMB());
json.put("Disk Access Stripes", config.getDiskAccessStripes());
json.put("Disk Expiry Thread Interval Seconds", config.getDiskExpiryThreadIntervalSeconds());
json.put("Logging Enabled", config.isLoggingEnabled());
json.put("Cache Event Listener Configurations", config.getCacheEventListenerConfigurations());
json.put("Cache Extension Configurations", config.getCacheExtensionConfigurations());
json.put("Cache Extension Configurations", config.getCacheExtensionConfigurations());
json.put("Bootstrap Cache Loader Factory Configuration", config.getBootstrapCacheLoaderFactoryConfiguration());
json.put("Cache Exception Handler Factory Configuration", config.getCacheExceptionHandlerFactoryConfiguration());
json.put("Terracotta Configuration", config.getTerracottaConfiguration());
json.put("Cache Writer Configuration", config.getCacheWriterConfiguration());
json.put("Cache Loader Configurations", config.getCacheLoaderConfigurations());
json.put("Frozen", config.isFrozen());
json.put("Transactional Mode", config.getTransactionalMode());
json.put("Statistics", config.getStatistics());
return json;
}
use of net.sf.ehcache.config.CacheConfiguration 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.config.CacheConfiguration in project cxf by apache.
the class EHCacheUtil method getCacheConfiguration.
public static CacheConfiguration getCacheConfiguration(String key, CacheManager cacheManager) {
CacheConfiguration cc = cacheManager.getConfiguration().getCacheConfigurations().get(key);
if (cc == null && key.contains("-")) {
cc = cacheManager.getConfiguration().getCacheConfigurations().get(key.substring(0, key.lastIndexOf('-') - 1));
}
if (cc == null) {
cc = cacheManager.getConfiguration().getDefaultCacheConfiguration();
}
if (cc == null) {
cc = new CacheConfiguration();
} else {
cc = cc.clone();
}
cc.setName(key);
return cc;
}
use of net.sf.ehcache.config.CacheConfiguration in project cxf by apache.
the class EHCacheXKMSClientCache method createCache.
private void createCache(String configFile, Bus cxfBus) {
if (cxfBus == null) {
cxfBus = BusFactory.getThreadDefaultBus(true);
}
URL configFileURL = null;
try {
configFileURL = ClassLoaderUtils.getResource(configFile, EHCacheXKMSClientCache.class);
} catch (Exception ex) {
// ignore
}
if (configFileURL == null) {
cacheManager = EHCacheUtil.createCacheManager();
} else {
Configuration conf = ConfigurationFactory.parseConfiguration(configFileURL);
if (cxfBus != null) {
conf.setName(cxfBus.getId());
DiskStoreConfiguration dsc = conf.getDiskStoreConfiguration();
if (dsc != null && "java.io.tmpdir".equals(dsc.getOriginalPath())) {
String path = conf.getDiskStoreConfiguration().getPath() + File.separator + cxfBus.getId();
conf.getDiskStoreConfiguration().setPath(path);
}
}
cacheManager = EHCacheUtil.createCacheManager(conf);
}
CacheConfiguration cc = EHCacheUtil.getCacheConfiguration(CACHE_KEY, cacheManager);
Ehcache newCache = new Cache(cc);
cache = cacheManager.addCacheIfAbsent(newCache);
}
use of net.sf.ehcache.config.CacheConfiguration in project cxf by apache.
the class EHCacheTokenReplayCache method createCache.
private void createCache(String configFile, Bus bus) {
if (bus == null) {
bus = BusFactory.getThreadDefaultBus(true);
}
URL configFileURL = null;
try {
configFileURL = ResourceUtils.getClasspathResourceURL(configFile, EHCacheTokenReplayCache.class, bus);
} catch (Exception ex) {
// ignore
}
if (configFileURL == null) {
cacheManager = EHCacheUtil.createCacheManager();
} else {
Configuration conf = ConfigurationFactory.parseConfiguration(configFileURL);
if (bus != null) {
conf.setName(bus.getId());
DiskStoreConfiguration dsc = conf.getDiskStoreConfiguration();
if (dsc != null && "java.io.tmpdir".equals(dsc.getOriginalPath())) {
String path = conf.getDiskStoreConfiguration().getPath() + File.separator + bus.getId();
conf.getDiskStoreConfiguration().setPath(path);
}
}
cacheManager = EHCacheUtil.createCacheManager(conf);
}
CacheConfiguration cc = EHCacheUtil.getCacheConfiguration(CACHE_KEY, cacheManager);
Ehcache newCache = new Cache(cc);
cache = cacheManager.addCacheIfAbsent(newCache);
}
Aggregations