Search in sources :

Example 11 with CacheConfiguration

use of net.sf.ehcache.config.CacheConfiguration in project ff4j by ff4j.

the class EhCacheCacheProviderTest method initCacheProvider.

@Test
public void initCacheProvider() {
    Configuration managerConfiguration = new Configuration();
    managerConfiguration.name("config");
    managerConfiguration.setDefaultCacheConfiguration(new CacheConfiguration("toto", 1000));
    FeatureCacheProviderEhCache fcec = new FeatureCacheProviderEhCache(managerConfiguration);
    Assert.assertNotNull(fcec.getCacheProviderName());
    fcec.setCacheFeatures(fcec.getCacheFeatures());
    fcec.setCacheProperties(fcec.getCacheProperties());
    fcec.setCacheConfiguration(fcec.getCacheConfiguration());
    fcec.setCacheManager(fcec.getCacheManager());
}
Also used : CacheConfiguration(net.sf.ehcache.config.CacheConfiguration) Configuration(net.sf.ehcache.config.Configuration) CacheConfiguration(net.sf.ehcache.config.CacheConfiguration) Test(org.junit.Test)

Example 12 with CacheConfiguration

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

the class DomainAccessControlStoreEhCache method createDrtCache.

private Cache createDrtCache() {
    // configure cache as searchable
    CacheConfiguration cacheConfig = new CacheConfiguration(CacheId.DOMAIN_ROLES.getIdAsString(), 0).eternal(true);
    Searchable searchable = new Searchable();
    cacheConfig.addSearchable(searchable);
    // register searchable attributes
    searchable.addSearchAttribute(new SearchAttribute().name(UserRoleKey.USER_ID));
    searchable.addSearchAttribute(new SearchAttribute().name(UserRoleKey.ROLE));
    cacheManager.addCache(new Cache(cacheConfig));
    return cacheManager.getCache(CacheId.DOMAIN_ROLES.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 13 with CacheConfiguration

use of net.sf.ehcache.config.CacheConfiguration in project BroadleafCommerce by BroadleafCommerce.

the class BigMemoryHydratedCacheManagerImpl method getHeap.

private synchronized Cache getHeap() {
    if (offHeap == null) {
        if (CacheManager.getInstance().cacheExists("hydrated-offheap-cache")) {
            offHeap = CacheManager.getInstance().getCache("hydrated-offheap-cache");
        } else {
            CacheConfiguration config = new CacheConfiguration("hydrated-offheap-cache", 500).eternal(true).overflowToOffHeap(true).maxMemoryOffHeap("1400M");
            Cache cache = new Cache(config);
            CacheManager.create().addCache(cache);
            offHeap = cache;
        }
    }
    return offHeap;
}
Also used : CacheConfiguration(net.sf.ehcache.config.CacheConfiguration) Cache(net.sf.ehcache.Cache)

Example 14 with CacheConfiguration

use of net.sf.ehcache.config.CacheConfiguration in project BroadleafCommerce by BroadleafCommerce.

the class EhcacheHydratedCacheManagerImpl method getHeap.

private synchronized Cache getHeap() {
    if (heap == null) {
        if (CacheManager.getInstance().cacheExists("hydrated-cache")) {
            heap = CacheManager.getInstance().getCache("hydrated-cache");
        } else {
            CacheConfiguration config = new CacheConfiguration("hydrated-cache", 0).eternal(true).overflowToDisk(false).maxElementsInMemory(100000);
            Cache cache = new Cache(config);
            CacheManager.create().addCache(cache);
            heap = cache;
        }
    }
    return heap;
}
Also used : CacheConfiguration(net.sf.ehcache.config.CacheConfiguration) Cache(net.sf.ehcache.Cache)

Example 15 with CacheConfiguration

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

the class AwsCachingConfig method cacheConfiguration.

@Override
public CacheConfiguration cacheConfiguration() {
    CacheConfiguration cacheConfiguration = new CacheConfiguration();
    cacheConfiguration.setMaxEntriesLocalHeap(MAX_ENTRIES);
    cacheConfiguration.setName(TEMPORARY_AWS_CREDENTIAL_CACHE);
    cacheConfiguration.setTimeToLiveSeconds(TTL_IN_SECONDS);
    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