日期:2014-05-19  浏览次数:20628 次

!关于ehcache缓存的问题
功能是用ssh+ehcache做的

使用查询缓存后
1)
select * from s where id=1

select * from s where id=1

select * from s where id=1

调用dao层查询方法3次,第二次,第三次是从缓存中查询的。就查了一次数据库。

2)
select * from s where id=1

select * from s where id=2

select * from s where id=3

这样就查3次数据库

求解决


------解决方案--------------------
先 select * from s

然后
select * from s where id=1

select * from s where id=2

select * from s where id=3

是查询多少次数据库?