List of usage examples for org.springframework.cache.ehcache EhCacheFactoryBean afterPropertiesSet
@Override public void afterPropertiesSet() throws CacheException
From source file:org.openvpms.archetype.rules.workflow.ScheduleTestHelper.java
/** * Helper to create an in-memory cache.//from w w w .j av a 2s . c om * * @param maxElementsInMemory specifies the maximum number of cached objects in memory * @return a new cache */ public static Ehcache createCache(int maxElementsInMemory) { EhCacheFactoryBean bean = new EhCacheFactoryBean(); bean.setCacheName("foo" + System.nanoTime()); bean.setMaxElementsInMemory(maxElementsInMemory); bean.setEternal(true); bean.setOverflowToDisk(false); try { bean.afterPropertiesSet(); } catch (IOException exception) { throw new CacheException(exception); } return bean.getObject(); }
From source file:fr.mby.saml2.sp.impl.core.EhcacheSaml20Storage.java
/** * Initialize caches if needed.//from w w w . j a v a2s .com * * @throws IOException * @throws CacheException */ protected void initCaches() throws CacheException, IOException { if (this.samlAuthenticationsCache == null) { final EhCacheFactoryBean cacheFactory = new EhCacheFactoryBean(); cacheFactory.setCacheName(EhcacheSaml20Storage.SAML2_AUTH_CREDS_CACHE_NAME); cacheFactory.afterPropertiesSet(); this.samlAuthenticationsCache = cacheFactory.getObject(); } this.samlAuthenticationsCache.bootstrap(); if (this.samlRequestWaitingForResponseCache == null) { final EhCacheFactoryBean cacheFactory = new EhCacheFactoryBean(); cacheFactory.setCacheName(EhcacheSaml20Storage.SAML2_RWFR_CACHE_NAME); cacheFactory.afterPropertiesSet(); this.samlRequestWaitingForResponseCache = cacheFactory.getObject(); } this.samlRequestWaitingForResponseCache.bootstrap(); if (this.saml2BaseIdCache == null) { final EhCacheFactoryBean cacheFactory = new EhCacheFactoryBean(); cacheFactory.setCacheName(EhcacheSaml20Storage.SAML2_BASE_ID_CACHE_NAME); cacheFactory.afterPropertiesSet(); this.saml2BaseIdCache = cacheFactory.getObject(); } this.saml2BaseIdCache.bootstrap(); if (this.saml2NameIdCache == null) { final EhCacheFactoryBean cacheFactory = new EhCacheFactoryBean(); cacheFactory.setCacheName(EhcacheSaml20Storage.SAML2_NAME_ID_CACHE_NAME); cacheFactory.afterPropertiesSet(); this.saml2NameIdCache = cacheFactory.getObject(); } this.saml2NameIdCache.bootstrap(); }