Search in sources :

Example 56 with CacheConfiguration

use of net.sf.ehcache.config.CacheConfiguration in project dble by actiontech.

the class TestCachePoolPerformance method createEnCachePool.

public static CachePool createEnCachePool() {
    CacheConfiguration cacheConf = new CacheConfiguration();
    cacheConf.setName("testcache");
    cacheConf.maxBytesLocalHeap(400, MemoryUnit.MEGABYTES).timeToIdleSeconds(3600);
    Cache cache = new Cache(cacheConf);
    CacheManager.create().addCache(cache);
    EnchachePool enCachePool = new EnchachePool(cacheConf.getName(), cache, 400 * 10000);
    return enCachePool;
}
Also used : EnchachePool(com.actiontech.dble.cache.impl.EnchachePool) CacheConfiguration(net.sf.ehcache.config.CacheConfiguration) Cache(net.sf.ehcache.Cache)

Example 57 with CacheConfiguration

use of net.sf.ehcache.config.CacheConfiguration in project joynr by bmwcarit.

the class DomainAccessControlStoreEhCache method createAclCache.

private Cache createAclCache(CacheId cacheId) {
    // configure cache as searchable
    CacheConfiguration cacheConfig = new CacheConfiguration(cacheId.getIdAsString(), 0).eternal(true);
    Searchable searchable = new Searchable();
    cacheConfig.addSearchable(searchable);
    // register searchable attributes
    searchable.addSearchAttribute(new SearchAttribute().name(UserDomainInterfaceOperationKey.USER_ID));
    searchable.addSearchAttribute(new SearchAttribute().name(UserDomainInterfaceOperationKey.DOMAIN));
    searchable.addSearchAttribute(new SearchAttribute().name(UserDomainInterfaceOperationKey.INTERFACE));
    searchable.addSearchAttribute(new SearchAttribute().name(UserDomainInterfaceOperationKey.OPERATION));
    cacheManager.addCache(new Cache(cacheConfig));
    return cacheManager.getCache(cacheId.getIdAsString());
}
Also used : SearchAttribute(net.sf.ehcache.config.SearchAttribute) Searchable(net.sf.ehcache.config.Searchable) CacheConfiguration(net.sf.ehcache.config.CacheConfiguration) Cache(net.sf.ehcache.Cache)

Example 58 with CacheConfiguration

use of net.sf.ehcache.config.CacheConfiguration in project cloudbreak by hortonworks.

the class UserCache method cacheConfiguration.

@Override
public CacheConfiguration cacheConfiguration() {
    CacheConfiguration cacheConfiguration = new CacheConfiguration();
    cacheConfiguration.setName("userCache");
    cacheConfiguration.setMemoryStoreEvictionPolicy("LRU");
    cacheConfiguration.setMaxEntriesLocalHeap(MAX_ENTRIES);
    cacheConfiguration.setTimeToLiveSeconds(TTL_IN_SECONDS);
    return cacheConfiguration;
}
Also used : CacheConfiguration(net.sf.ehcache.config.CacheConfiguration)

Example 59 with CacheConfiguration

use of net.sf.ehcache.config.CacheConfiguration in project cloudbreak by hortonworks.

the class CloudResourceRegionCache method cacheConfiguration.

@Override
public CacheConfiguration cacheConfiguration() {
    CacheConfiguration cacheConfiguration = new CacheConfiguration();
    cacheConfiguration.setName("cloudResourceRegionCache");
    cacheConfiguration.setMemoryStoreEvictionPolicy("LRU");
    cacheConfiguration.setMaxEntriesLocalHeap(MAX_ENTRIES);
    return cacheConfiguration;
}
Also used : CacheConfiguration(net.sf.ehcache.config.CacheConfiguration)

Example 60 with CacheConfiguration

use of net.sf.ehcache.config.CacheConfiguration in project cloudbreak by hortonworks.

the class ImageCatalogCache method cacheConfiguration.

@Override
public CacheConfiguration cacheConfiguration() {
    CacheConfiguration cacheConfiguration = new CacheConfiguration();
    cacheConfiguration.setName("imageCatalogCache");
    cacheConfiguration.setMemoryStoreEvictionPolicy("LRU");
    cacheConfiguration.setMaxEntriesLocalHeap(MAX_ENTRIES);
    // Cache cannot be turned off, the default value is 0, which means no timeToLive (TTL) eviction takes place (infinite lifetime).
    cacheConfiguration.setTimeToLiveSeconds(ttlMinutes == 0L ? 1 : TimeUnit.MINUTES.toSeconds(ttlMinutes));
    return cacheConfiguration;
}
Also used : CacheConfiguration(net.sf.ehcache.config.CacheConfiguration)

Aggregations

CacheConfiguration (net.sf.ehcache.config.CacheConfiguration)71 Cache (net.sf.ehcache.Cache)26 CacheManager (net.sf.ehcache.CacheManager)16 Ehcache (net.sf.ehcache.Ehcache)14 Configuration (net.sf.ehcache.config.Configuration)14 Element (net.sf.ehcache.Element)9 PersistenceConfiguration (net.sf.ehcache.config.PersistenceConfiguration)8 DiskStoreConfiguration (net.sf.ehcache.config.DiskStoreConfiguration)6 Test (org.junit.Test)6 Resource (org.springframework.core.io.Resource)6 IOException (java.io.IOException)5 Bean (org.springframework.context.annotation.Bean)5 CachedResource (org.apereo.portal.utils.cache.resource.CachedResource)4 CachingResourceLoaderImpl (org.apereo.portal.utils.cache.resource.CachingResourceLoaderImpl)4 LoadedResource (org.apereo.portal.utils.cache.resource.LoadedResource)4 ResourcesElementsProvider (org.jasig.resourceserver.utils.aggr.ResourcesElementsProvider)4 FileSystemResource (org.springframework.core.io.FileSystemResource)4 FileReader (java.io.FileReader)3 URL (java.net.URL)3 SelfPopulatingCache (net.sf.ehcache.constructs.blocking.SelfPopulatingCache)3