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

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

 

上一篇:Spring-quartz定时系统多任务配置


下一篇:ElasticSearch