<?xml version="1.0" encoding="utf-8"?>
<ehcache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:noNamespaceSchemaLocation="ehcache.xsd">
	<diskStore path="java.io.tmpdir" />
	<defaultCache maxElementsInMemory="1000" eternal="false"
		timeToIdleSeconds="600" timeToLiveSeconds="600" overflowToDisk="true"
		memoryStoreEvictionPolicy="LRU" />
	<cache name="aaa" maxElementsInMemory="5000" eternal="false"
		timeToLiveSeconds="7200" timeToIdleSeconds="7200" overflowToDisk="true" />
</ehcache>
private static CacheManager cacheManager = null;
 private static Cache ehcache = null;
	static {
		cacheManager = CacheManager.create();
		ehcache = cacheManager.getCache("aaa");
	}
 Element element = new Element("shaoer", list);
					ehcache.put(element);
......................
原文:http://www.cnblogs.com/coderdxj/p/6393081.html