功能是用ssh+ehcache做的使用查询缓存后
1)
select * from s where id=1select * from s where id=1select * from s where id=1调用dao层查询方法3次,第二次,第三次是从缓存中查询的。就查了一次数据库。2)
select * from s where id=1select * from s where id=2select * from s where id=3这样就查3次数据库求解决
1)
select * from s where id=1select * from s where id=1select * from s where id=1调用dao层查询方法3次,第二次,第三次是从缓存中查询的。就查了一次数据库。2)
select * from s where id=1select * from s where id=2select * from s where id=3这样就查3次数据库求解决
select * from s where id=1select * from s where id=2select * from s where id=3是查询多少次数据库?
select * from s where id=1select * from s where id=1select * from s where id=1
这样会执行1次查数据库的,缓存开了
xsi:noNamespaceSchemaLocation="ehcache.xsd" updateCheck="true"
monitoring="autodetect">
<diskStore path="java.io.tmpdir"/>
<defaultCache
maxElementsInMemory="10000"
eternal="false"
timeToIdleSeconds="300"
timeToLiveSeconds="180"
overflowToDisk="true"
maxElementsOnDisk="10000000"
diskPersistent="false"
diskExpiryThreadIntervalSeconds="120"
memoryStoreEvictionPolicy="LRU"
/>
<cache name="fileCache"
maxElementsInMemory="10000"
maxElementsOnDisk="1000"
eternal="false"
overflowToDisk="true"
diskSpoolBufferSizeMB="20"
timeToIdleSeconds="300"
timeToLiveSeconds="180"
memoryStoreEvictionPolicy="LFU"
/>
</ehcache>
你看看这个配置文件不会过期吧?