當前位置: 首頁>>代碼示例>>Java>>正文


Java CacheConfiguration.getName方法代碼示例

本文整理匯總了Java中net.sf.ehcache.config.CacheConfiguration.getName方法的典型用法代碼示例。如果您正苦於以下問題:Java CacheConfiguration.getName方法的具體用法?Java CacheConfiguration.getName怎麽用?Java CacheConfiguration.getName使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在net.sf.ehcache.config.CacheConfiguration的用法示例。


在下文中一共展示了CacheConfiguration.getName方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: createEnCachePool

import net.sf.ehcache.config.CacheConfiguration; //導入方法依賴的package包/類
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;
}
 
開發者ID:huang-up,項目名稱:mycat-src-1.6.1-RELEASE,代碼行數:11,代碼來源:TestCachePoolPerformance.java

示例2: createEnCachePool

import net.sf.ehcache.config.CacheConfiguration; //導入方法依賴的package包/類
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;
}
 
開發者ID:actiontech,項目名稱:dble,代碼行數:11,代碼來源:TestCachePoolPerformance.java

示例3: init

import net.sf.ehcache.config.CacheConfiguration; //導入方法依賴的package包/類
@SuppressWarnings({ "unchecked", "unused" })
public void init() {
	log.info("Loading ehcache");
	// log.debug("Appcontext: " + applicationContext.toString());
	try {
		// instance the manager
		CacheManager cm = CacheManager.getInstance();
		// Use the Configuration to create our caches
		Configuration configuration = new Configuration();
		//set initial default cache name
		String defaultCacheName = Cache.DEFAULT_CACHE_NAME;
		//add the configs to a configuration
		for (CacheConfiguration conf : configs) {
			//set disk expiry
			conf.setDiskExpiryThreadIntervalSeconds(diskExpiryThreadIntervalSeconds);
			//set eviction policy
			conf.setMemoryStoreEvictionPolicy(memoryStoreEvictionPolicy);
			if (null == cache) {
				//get first cache name and use as default
				defaultCacheName = conf.getName();
				configuration.addDefaultCache(conf);
			} else {
				configuration.addCache(conf);
			}
		}
		//instance the helper
		ConfigurationHelper helper = new ConfigurationHelper(cm, configuration);
		//create the default cache
		cache = helper.createDefaultCache();
		//init the default
		cache.initialise();
		cache.bootstrap();
		//create the un-init'd caches
		Set<Cache> caches = helper.createCaches();
		if (log.isDebugEnabled()) {
			log.debug("Number of caches: " + caches.size() + " Default cache: " + (cache != null ? 1 : 0));
		}
		for (Cache nonDefaultCache : caches) {
			nonDefaultCache.initialise();
			nonDefaultCache.bootstrap();
			//set first cache to be main local member
			if (null == nonDefaultCache) {
				log.debug("Default cache name: {}", defaultCacheName);
				nonDefaultCache = cm.getCache(defaultCacheName);
			}
		}
	} catch (Exception e) {
		log.warn("Error on cache init", e);
	}
	if (log.isDebugEnabled()) {
		log.debug("Cache is null? {}", (null == cache));
	}
}
 
開發者ID:Kyunghwa-Yoo,項目名稱:StitchRTSP,代碼行數:54,代碼來源:EhCacheImpl.java

示例4: init

import net.sf.ehcache.config.CacheConfiguration; //導入方法依賴的package包/類
@SuppressWarnings({ "unchecked", "unused" })
public void init() {
    log.info("Loading ehcache");
    // log.debug("Appcontext: " + applicationContext.toString());
    try {
        // instance the manager
        CacheManager cm = CacheManager.getInstance();
        // Use the Configuration to create our caches
        Configuration configuration = new Configuration();
        //set initial default cache name
        String defaultCacheName = Cache.DEFAULT_CACHE_NAME;
        //add the configs to a configuration
        for (CacheConfiguration conf : configs) {
            //set disk expiry
            conf.setDiskExpiryThreadIntervalSeconds(diskExpiryThreadIntervalSeconds);
            //set eviction policy
            conf.setMemoryStoreEvictionPolicy(memoryStoreEvictionPolicy);
            if (null == cache) {
                //get first cache name and use as default
                defaultCacheName = conf.getName();
                configuration.addDefaultCache(conf);
            } else {
                configuration.addCache(conf);
            }
        }
        //instance the helper
        ConfigurationHelper helper = new ConfigurationHelper(cm, configuration);
        //create the default cache
        cache = helper.createDefaultCache();
        //init the default
        cache.initialise();
        cache.bootstrap();
        //create the un-init'd caches
        Set<Cache> caches = helper.createCaches();
        if (log.isDebugEnabled()) {
            log.debug("Number of caches: " + caches.size() + " Default cache: " + (cache != null ? 1 : 0));
        }
        for (Cache nonDefaultCache : caches) {
            nonDefaultCache.initialise();
            nonDefaultCache.bootstrap();
            //set first cache to be main local member
            if (null == nonDefaultCache) {
                log.debug("Default cache name: {}", defaultCacheName);
                nonDefaultCache = cm.getCache(defaultCacheName);
            }
        }
    } catch (Exception e) {
        log.warn("Error on cache init", e);
    }
    if (log.isDebugEnabled()) {
        log.debug("Cache is null? {}", (null == cache));
    }
}
 
開發者ID:Red5,項目名稱:red5-io,代碼行數:54,代碼來源:EhCacheImpl.java


注:本文中的net.sf.ehcache.config.CacheConfiguration.getName方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。