Example usage for org.springframework.cache.ehcache EhCacheFactoryBean EhCacheFactoryBean

List of usage examples for org.springframework.cache.ehcache EhCacheFactoryBean EhCacheFactoryBean

Introduction

In this page you can find the example usage for org.springframework.cache.ehcache EhCacheFactoryBean EhCacheFactoryBean.

Prototype

public EhCacheFactoryBean() 

Source Link

Usage

From source file:org.createnet.raptor.auth.service.AclConfiguration.java

@Bean
public EhCacheFactoryBean aclEhCacheFactoryBean() {
    EhCacheFactoryBean ehCacheFactoryBean = new EhCacheFactoryBean();
    ehCacheFactoryBean.setCacheManager(aclCacheManager().getObject());
    ehCacheFactoryBean.setCacheName("aclCache");
    return ehCacheFactoryBean;
}

From source file:org.bremersee.common.spring.autoconfigure.AclCacheAutoConfiguration.java

@Bean
public EhCacheFactoryBean ehCacheFactoryBean() {
    final EhCacheFactoryBean factoryBean = new EhCacheFactoryBean();
    factoryBean.setName(StringUtils.isEmpty(aclProperties.getAclCacheName()) ? "aclCache"
            : aclProperties.getAclCacheName());
    if (cacheManager != null) {
        factoryBean.setCacheManager(cacheManager);
    }/*from  ww  w. j  a  v  a  2  s.c o m*/
    return factoryBean;
}

From source file:fr.mby.saml2.sp.impl.core.EhcacheSaml20Storage.java

/**
 * Initialize caches if needed./*from   w  w w.j a v  a  2s  .c  o m*/
 * 
 * @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();
}

From source file:cz.lbenda.coursing.client.ClientAppConfig.java

public @Bean EhCacheFactoryBean userCacheBackend() {
    EhCacheFactoryBean result = new EhCacheFactoryBean();
    result.setCacheManager(cacheManager());
    result.setCacheName("userCache");
    return result;
}

From source file:org.openvpms.archetype.rules.workflow.ScheduleTestHelper.java

/**
 * Helper to create an in-memory cache.//  w w w  .  java 2s .c o  m
 *
 * @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();
}