Ehcahe独立使用

<?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);

......................

 

posted @ 2017-02-13 11:33  洞玄巅峰  阅读(342)  评论(1编辑  收藏  举报