use of org.springframework.cache.ehcache.EhCacheManagerFactoryBean in project vip by guangdada.
the class EhCacheConfig method ehcache.
/**
* EhCache的配置
*/
@Bean
public EhCacheManagerFactoryBean ehcache() {
EhCacheManagerFactoryBean ehCacheManagerFactoryBean = new EhCacheManagerFactoryBean();
ehCacheManagerFactoryBean.setConfigLocation(new ClassPathResource("ehcache.xml"));
return ehCacheManagerFactoryBean;
}
use of org.springframework.cache.ehcache.EhCacheManagerFactoryBean in project cas by apereo.
the class EhcacheTicketRegistryConfiguration method ehcacheTicketCacheManager.
@Bean
@RefreshScope(proxyMode = ScopedProxyMode.DEFAULT)
@ConditionalOnMissingBean(name = "ehcacheTicketCacheManager")
public CacheManager ehcacheTicketCacheManager(@Qualifier("ticketRMISynchronousCacheReplicator") final CacheReplicator ticketRMISynchronousCacheReplicator, @Qualifier("ticketCacheBootstrapCacheLoader") final BootstrapCacheLoader ticketCacheBootstrapCacheLoader, @Qualifier(TicketCatalog.BEAN_NAME) final TicketCatalog ticketCatalog, final CasConfigurationProperties casProperties) {
AsciiArtUtils.printAsciiArtWarning(LOGGER, "CAS Integration with ehcache 2.x will be discontinued after CAS 6.2.x. Consider migrating to another type of registry.");
val cache = casProperties.getTicket().getRegistry().getEhcache();
val bean = new EhCacheManagerFactoryBean();
cache.getSystemProps().forEach(System::setProperty);
val configExists = ResourceUtils.doesResourceExist(cache.getConfigLocation());
if (configExists) {
bean.setConfigLocation(cache.getConfigLocation());
} else {
LOGGER.warn("Ehcache configuration file [{}] cannot be found", cache.getConfigLocation());
}
bean.setShared(cache.isShared());
bean.setCacheManagerName(cache.getCacheManagerName());
bean.afterPropertiesSet();
val ehCacheManager = bean.getObject();
val definitions = ticketCatalog.findAll();
definitions.forEach(ticketDefn -> {
val ehcache = buildCache(casProperties, ticketDefn, ticketRMISynchronousCacheReplicator, ticketCacheBootstrapCacheLoader);
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("Created Ehcache cache [{}] for [{}]", ehcache.getName(), ticketDefn);
val config = ehcache.getCacheConfiguration();
LOGGER.debug("[{}].maxEntriesLocalHeap=[{}]", ehcache.getName(), config.getMaxEntriesLocalHeap());
LOGGER.debug("[{}].maxEntriesLocalDisk=[{}]", ehcache.getName(), config.getMaxEntriesLocalDisk());
LOGGER.debug("[{}].maxEntriesInCache=[{}]", ehcache.getName(), config.getMaxEntriesInCache());
LOGGER.debug("[{}].persistenceConfiguration=[{}]", ehcache.getName(), config.getPersistenceConfiguration().getStrategy());
LOGGER.debug("[{}].synchronousWrites=[{}]", ehcache.getName(), config.getPersistenceConfiguration().getSynchronousWrites());
LOGGER.debug("[{}].timeToLive=[{}]", ehcache.getName(), config.getTimeToLiveSeconds());
LOGGER.debug("[{}].timeToIdle=[{}]", ehcache.getName(), config.getTimeToIdleSeconds());
LOGGER.debug("[{}].cacheManager=[{}]", ehcache.getName(), ehcache.getCacheManager().getName());
}
ehCacheManager.addDecoratedCacheIfAbsent(ehcache);
});
LOGGER.debug("The following caches are available: [{}]", Arrays.toString(ehCacheManager.getCacheNames()));
return ehCacheManager;
}
use of org.springframework.cache.ehcache.EhCacheManagerFactoryBean in project wechat by dllwh.
the class EhCacheConfig method ehcache.
/**
* @方法描述 : EhCache的配置
* @return
*/
public EhCacheManagerFactoryBean ehcache() {
EhCacheManagerFactoryBean ehCacheManagerFactoryBean = new EhCacheManagerFactoryBean();
ehCacheManagerFactoryBean.setConfigLocation(new ClassPathResource(ehcache_path));
return ehCacheManagerFactoryBean;
}
use of org.springframework.cache.ehcache.EhCacheManagerFactoryBean in project cas by apereo.
the class EhcacheTicketRegistryConfiguration method ehcacheTicketCacheManager.
@Bean
public EhCacheManagerFactoryBean ehcacheTicketCacheManager() {
final EhcacheProperties cache = casProperties.getTicket().getRegistry().getEhcache();
final EhCacheManagerFactoryBean bean = new EhCacheManagerFactoryBean();
final boolean configExists = ResourceUtils.doesResourceExist(cache.getConfigLocation());
if (configExists) {
bean.setConfigLocation(cache.getConfigLocation());
} else {
LOGGER.warn("Ehcache configuration file [{}] cannot be found", cache.getConfigLocation());
}
bean.setShared(cache.isShared());
bean.setCacheManagerName(cache.getCacheManagerName());
return bean;
}
use of org.springframework.cache.ehcache.EhCacheManagerFactoryBean in project tesla by linking12.
the class CacheConfiguration method ehCacheManagerFactoryBean.
@Bean
public EhCacheManagerFactoryBean ehCacheManagerFactoryBean() {
EhCacheManagerFactoryBean cacheManagerFactoryBean = new EhCacheManagerFactoryBean();
cacheManagerFactoryBean.setConfigLocation(new ClassPathResource("config/ehcache.xml"));
cacheManagerFactoryBean.setShared(true);
return cacheManagerFactoryBean;
}
Aggregations