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 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 ORCID-Source by ORCID.
the class WorksCacheManagerImpl method init.
@PostConstruct
private void init() {
CacheConfiguration config1 = groupedWorksCache.getCacheConfiguration();
groupedWorksCacheTTI = config1.getTimeToIdleSeconds() > 0 ? TimeUtil.convertTimeToInt(config1.getTimeToIdleSeconds()) : DEFAULT_TTI;
groupedWorksCacheTTL = config1.getTimeToLiveSeconds() > 0 ? TimeUtil.convertTimeToInt(config1.getTimeToLiveSeconds()) : DEFAULT_TTL;
}
use of net.sf.ehcache.config.CacheConfiguration in project herd by FINRAOS.
the class DaoSpringModuleConfig method ehCacheManager.
/**
* Gets an EH Cache manager.
*
* @return the EH Cache manager.
*/
@Bean(destroyMethod = "shutdown")
public net.sf.ehcache.CacheManager ehCacheManager() {
CacheConfiguration cacheConfiguration = new CacheConfiguration();
cacheConfiguration.setName(HERD_CACHE_NAME);
cacheConfiguration.setTimeToLiveSeconds(configurationHelper.getProperty(ConfigurationValue.HERD_CACHE_TIME_TO_LIVE_SECONDS, Long.class));
cacheConfiguration.setTimeToIdleSeconds(configurationHelper.getProperty(ConfigurationValue.HERD_CACHE_TIME_TO_IDLE_SECONDS, Long.class));
cacheConfiguration.setMaxElementsInMemory(configurationHelper.getProperty(ConfigurationValue.HERD_CACHE_MAX_ELEMENTS_IN_MEMORY, Integer.class));
cacheConfiguration.setMemoryStoreEvictionPolicy(configurationHelper.getProperty(ConfigurationValue.HERD_CACHE_MEMORY_STORE_EVICTION_POLICY));
net.sf.ehcache.config.Configuration config = new net.sf.ehcache.config.Configuration();
config.addCache(cacheConfiguration);
return net.sf.ehcache.CacheManager.create(config);
}
use of net.sf.ehcache.config.CacheConfiguration in project openmrs-core by openmrs.
the class CachePropertiesUtil method createCacheConfiguration.
private static CacheConfiguration createCacheConfiguration(OpenmrsCacheConfiguration openmrsCacheConfiguration) {
CacheConfiguration cacheConfiguration = new CacheConfiguration();
openmrsCacheConfiguration.getAllKeys().forEach(key -> {
try {
BeanUtils.setProperty(cacheConfiguration, key, openmrsCacheConfiguration.getProperty(key));
} catch (IllegalAccessException | InvocationTargetException e) {
throw new IllegalStateException(e);
}
});
return cacheConfiguration;
}
Aggregations