Search in sources :

Example 1 with EhcacheProperties

use of org.apereo.cas.configuration.model.support.ehcache.EhcacheProperties in project cas by apereo.

the class EhcacheTicketRegistryConfiguration method cacheManager.

@Lazy
@Bean
public EhCacheManagerFactoryBean cacheManager() {
    final EhcacheProperties cache = casProperties.getTicket().getRegistry().getEhcache();
    final EhCacheManagerFactoryBean bean = new EhCacheManagerFactoryBean();
    bean.setConfigLocation(cache.getConfigLocation());
    bean.setShared(cache.isShared());
    bean.setCacheManagerName(cache.getCacheManagerName());
    return bean;
}
Also used : EhCacheManagerFactoryBean(org.springframework.cache.ehcache.EhCacheManagerFactoryBean) EhcacheProperties(org.apereo.cas.configuration.model.support.ehcache.EhcacheProperties) Lazy(org.springframework.context.annotation.Lazy) EhCacheFactoryBean(org.springframework.cache.ehcache.EhCacheFactoryBean) EhCacheManagerFactoryBean(org.springframework.cache.ehcache.EhCacheManagerFactoryBean) Bean(org.springframework.context.annotation.Bean)

Example 2 with EhcacheProperties

use of org.apereo.cas.configuration.model.support.ehcache.EhcacheProperties in project cas by apereo.

the class EhcacheTicketRegistryConfiguration method ehcacheTicketsCache.

@Lazy
@Autowired
@Bean
public EhCacheFactoryBean ehcacheTicketsCache(@Qualifier("cacheManager") final CacheManager manager) {
    final EhcacheProperties ehcacheProperties = casProperties.getTicket().getRegistry().getEhcache();
    final EhCacheFactoryBean bean = new EhCacheFactoryBean();
    bean.setCacheName(ehcacheProperties.getCacheName());
    bean.setCacheEventListeners(Collections.singleton(ticketRMISynchronousCacheReplicator()));
    bean.setTimeToIdle(ehcacheProperties.getCacheTimeToIdle());
    bean.setTimeToLive(ehcacheProperties.getCacheTimeToLive());
    bean.setCacheManager(manager);
    bean.setBootstrapCacheLoader(ticketCacheBootstrapCacheLoader());
    bean.setDiskExpiryThreadIntervalSeconds(ehcacheProperties.getDiskExpiryThreadIntervalSeconds());
    bean.setEternal(ehcacheProperties.isEternal());
    bean.setMaxEntriesLocalHeap(ehcacheProperties.getMaxElementsInMemory());
    bean.setMaxEntriesInCache(ehcacheProperties.getMaxElementsInCache());
    bean.setMaxEntriesLocalDisk(ehcacheProperties.getMaxElementsOnDisk());
    bean.setMemoryStoreEvictionPolicy(ehcacheProperties.getMemoryStoreEvictionPolicy());
    final PersistenceConfiguration c = new PersistenceConfiguration();
    c.strategy(ehcacheProperties.getPersistence());
    c.setSynchronousWrites(ehcacheProperties.isSynchronousWrites());
    bean.persistence(c);
    return bean;
}
Also used : EhCacheFactoryBean(org.springframework.cache.ehcache.EhCacheFactoryBean) PersistenceConfiguration(net.sf.ehcache.config.PersistenceConfiguration) EhcacheProperties(org.apereo.cas.configuration.model.support.ehcache.EhcacheProperties) Lazy(org.springframework.context.annotation.Lazy) Autowired(org.springframework.beans.factory.annotation.Autowired) EhCacheFactoryBean(org.springframework.cache.ehcache.EhCacheFactoryBean) EhCacheManagerFactoryBean(org.springframework.cache.ehcache.EhCacheManagerFactoryBean) Bean(org.springframework.context.annotation.Bean)

Aggregations

EhcacheProperties (org.apereo.cas.configuration.model.support.ehcache.EhcacheProperties)2 EhCacheFactoryBean (org.springframework.cache.ehcache.EhCacheFactoryBean)2 EhCacheManagerFactoryBean (org.springframework.cache.ehcache.EhCacheManagerFactoryBean)2 Bean (org.springframework.context.annotation.Bean)2 Lazy (org.springframework.context.annotation.Lazy)2 PersistenceConfiguration (net.sf.ehcache.config.PersistenceConfiguration)1 Autowired (org.springframework.beans.factory.annotation.Autowired)1