Package net.sf.ehcache

Examples of net.sf.ehcache.Cache


      final CacheManager manager = getCacheManager();
      synchronized(manager)
      {
        if (manager.cacheExists(BUNDLES_CACHE_NAME) == false)
        {
          final Cache libloaderCache = new Cache(BUNDLES_CACHE_NAME,   // cache name
                                                 500,         // maxElementsInMemory
                                                 false,       // overflowToDisk
                                                 false,       // eternal
                                                 600,         // timeToLiveSeconds
                                                 600,         // timeToIdleSeconds
View Full Code Here


      final CacheManager manager = getCacheManager();
      synchronized(manager)
      {
        if (manager.cacheExists(FACTORY_CACHE_NAME) == false)
        {
          final Cache libloaderCache = new Cache(FACTORY_CACHE_NAME,   // cache name
                                                 500,         // maxElementsInMemory
                                                 false,       // overflowToDisk
                                                 false,       // eternal
                                                 600,         // timeToLiveSeconds
                                                 600,         // timeToIdleSeconds
View Full Code Here

    LogManager.getLogger(FsDirectory.class).setLevel(Level.WARN);
    CacheManager mgr = CacheManager.create();
    synchronized(mgr) {
      cache = mgr.getCache("dfsin");
      if (cache == null) {
        cache = new Cache("dfsin", 2000, MemoryStoreEvictionPolicy.LFU,
                true, diskCacheDir, false, 1800, 600, false, 300, null);
        mgr.addCache(cache);
        cache = mgr.getCache("dfsin");
        LOG.info("Created cache: " + cache.toString());
      }
View Full Code Here

        if (value != null) {
            final CacheManager cm = CacheManager.create();
            final int maxElements = NumbersUtil.parseInt(value, 0);
            final int live = NumbersUtil.parseInt((String)params.get("cache.time.to.live"), 300);
            final int idle = NumbersUtil.parseInt((String)params.get("cache.time.to.idle"), 300);
            _cache = new Cache(getName(), maxElements, false, live == -1, live == -1 ? Integer.MAX_VALUE : live, idle);
            cm.addCache(_cache);
            s_logger.info("Cache created: " + _cache.toString());
        } else {
            _cache = null;
        }
View Full Code Here

            String cachesize = _configDao.getValue(Config.ApiLimitCacheSize.key());
            if ( cachesize != null ){
                maxElements = Integer.parseInt(cachesize);
            }
            CacheManager cm = CacheManager.create();
            Cache cache = new Cache("api-limit-cache", maxElements, false, false, timeToLive, timeToLive);
            cm.addCache(cache);
            s_logger.info("Limit Cache created with timeToLive=" + timeToLive + ", maxAllowed=" + maxAllowed + ", maxElements=" + maxElements );
            cacheStore.setCache(cache);
            _store = cacheStore;
View Full Code Here

     * Initialize the CacheManager and created the Cache.
     */
    public void initialize() throws Exception {
        URL configFileURL = Thread.currentThread().getContextClassLoader().getResource(CONFIG_FILE);
        this.cacheManager = CacheManager.create(configFileURL);
        this.cache = new Cache(this.cacheName, this.maxObjects, this.overflowToDisk, true, 0, 0, true, 120);
        this.cacheManager.addCache(this.cache);
        this.storeJanitor.register(this);
    }
View Full Code Here

                LOG.trace("Cache " + config.getCacheName() + " currently contains "
                        + cacheManager.getCache(config.getCacheName()).getSize() + " elements");
            }
            cache = cacheManager.getCache(config.getCacheName());
        } else {
            cache = new Cache(config.getCacheName(),
                    config.getMaxElementsInMemory(),
                    config.getMemoryStoreEvictionPolicy(),
                    config.isOverflowToDisk(),
                    config.getDiskStorePath(),
                    config.isEternal(),
View Full Code Here

        if (cacheManager.cacheExists(config.getCacheName())) {
            cache = cacheManager.getCache(config.getCacheName());
            cache.getCacheEventNotificationService().registerListener(cacheEventListener);
        } else {
            cache = new Cache(config.getCacheName(),
                    config.getMaxElementsInMemory(),
                    config.getMemoryStoreEvictionPolicy(),
                    config.isOverflowToDisk(),
                    config.getDiskStorePath(),
                    config.isEternal(),
View Full Code Here

            } else {
                cacheManager = CacheManager.create(configFileURL);
            }
        }
        if (!cacheManager.cacheExists(key)) {
            cache = new Cache(key, 50000, true, false, DEFAULT_TTL, DEFAULT_TTL);
            cacheManager.addCache(cache);
        } else {
            cache = cacheManager.getCache(key);
        }
    }
View Full Code Here

            }
        }
       
        if (!cacheManager.cacheExists(key)) {
            // Cannot overflow to disk as SecurityToken Elements can't be serialized
            cache = new Cache(key, MAX_ELEMENTS, false, false, DEFAULT_TTL, DEFAULT_TTL);
            cacheManager.addCache(cache);
        } else {
            cache = cacheManager.getCache(key);
        }
    }
View Full Code Here

TOP

Related Classes of net.sf.ehcache.Cache

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.