Package net.sf.ehcache.config

Examples of net.sf.ehcache.config.CacheConfiguration


    @BeforeClass
    public static void setUpGlobal() {
        Configuration config = new Configuration();
        config.addDefaultCache(
                new CacheConfiguration("default", Integer.MAX_VALUE)
                    .memoryStoreEvictionPolicy(MemoryStoreEvictionPolicy.LFU)
                    .overflowToDisk(false));
        CACHE_MANAGER = CacheManager.create(config);
    }
View Full Code Here


    @BeforeClass
    public static void setUpGlobal() {
        Configuration config = new Configuration();
        config.addDefaultCache(
                new CacheConfiguration("default", Integer.MAX_VALUE)
                    .memoryStoreEvictionPolicy(MemoryStoreEvictionPolicy.LFU)
                    .overflowToDisk(false));
        CACHE_MANAGER = CacheManager.create(config);
    }
View Full Code Here

    @BeforeClass
    public static void setUpGlobal() {
        final Configuration config = new Configuration();
        config.addDefaultCache(
                new CacheConfiguration("default", Integer.MAX_VALUE)
                    .memoryStoreEvictionPolicy(MemoryStoreEvictionPolicy.LFU)
                    .overflowToDisk(false));
        CACHE_MANAGER = CacheManager.create(config);
    }
View Full Code Here

    @BeforeClass
    public static void setUpGlobal() {
        Configuration config = new Configuration();
        config.addDefaultCache(
                new CacheConfiguration("default", Integer.MAX_VALUE)
                    .memoryStoreEvictionPolicy(MemoryStoreEvictionPolicy.LFU)
                    .overflowToDisk(false));
        CACHE_MANAGER = CacheManager.create(config);
    }
View Full Code Here

  @Override
  public Struct getCustomInfo() {
    Struct info=super.getCustomInfo();
    // custom
    CacheConfiguration conf = getCache().getCacheConfiguration();
    info.setEL("disk_expiry_thread_interval", new Double(conf.getDiskExpiryThreadIntervalSeconds()));
    info.setEL("disk_spool_buffer_size", new Double(conf.getDiskSpoolBufferSizeMB()*1024*1024));
    info.setEL("max_elements_in_memory", new Double(conf.getMaxElementsInMemory()));
    info.setEL("max_elements_on_disk", new Double(conf.getMaxElementsOnDisk()));
    info.setEL("time_to_idle", new Double(conf.getTimeToIdleSeconds()));
    info.setEL("time_to_live", new Double(conf.getTimeToLiveSeconds()));
    info.setEL(KeyConstants._name, conf.getName());
    return info;
  }
View Full Code Here

    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;
            }
        }
View Full Code Here

    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;
            }
        }
View Full Code Here

    public static final int MAX_ENTRIES = 1000;

    @Bean
    public net.sf.ehcache.CacheManager ehCacheManager() {
        CacheConfiguration cacheConfiguration = new CacheConfiguration();
        cacheConfiguration.setName("userCache");
        cacheConfiguration.setMemoryStoreEvictionPolicy("LRU");
        cacheConfiguration.setMaxEntriesLocalHeap(MAX_ENTRIES);

        net.sf.ehcache.config.Configuration config = new net.sf.ehcache.config.Configuration();
        config.addCache(cacheConfiguration);

        return net.sf.ehcache.CacheManager.newInstance(config);
View Full Code Here

    }

    protected Ehcache attachCache() {
        CacheManager.getInstance().addCacheIfAbsent("da_cache");
        Ehcache cache = CacheManager.getInstance().getCache("da_cache");
        CacheConfiguration conf = cache.getCacheConfiguration();
        conf.setTimeToLiveSeconds(30);
        return cache;
    }
View Full Code Here

public class TestUtils {
    private static int cacheNo = 0;

    public static Ehcache getEhcache() {
        CacheManager mgr = CacheManager.getInstance();
        CacheConfiguration conf = new CacheConfiguration("cache-" + cacheNo++, 0)
                .persistence(new PersistenceConfiguration()
                        .strategy(PersistenceConfiguration.Strategy.NONE));
        conf.setTimeToIdleSeconds(10);

        Cache cache = new Cache(conf);
        mgr.addCache(cache);

        return cache;
View Full Code Here

TOP

Related Classes of net.sf.ehcache.config.CacheConfiguration

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.