use of org.springframework.cache.ehcache.EhCacheFactoryBean 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;
}
Aggregations