ehcache使用方法

		try
		{

			this.cacheManager = CacheManager.create();
			cache = cacheManager.getCache(CACHENAME);
			if (cache == null)
			{
				cache = new Cache(CACHENAME, 10, true, true, 30 * 60, 0);
				// cache.getCacheConfiguration().setMemoryStoreEvictionPolicy("LRU");
				this.cacheManager.addCache(cache);
			}

		} catch (CacheException e)
		{
			log.error("init cache error", e);
			throw new IllegalStateException(e);
		}




	Element element = new Element(CACHENAME, t.getValue());
		cache.put(element);
		if (log.isDebugEnabled())
		{
			log.debug("reload version cache");
		}

你可能感兴趣的:(java,cache)