NutzCN Logo
问答 集成ehcache的缓存问题
发布于 1451天前 作者 ethanyuen 1420 次浏览 复制 上一个帖子 下一个帖子
标签:

| 11-30 14:00:17 [worker-3-4] DEBUG org.nutz.plugins.cache.dao.CachedNutDaoExecutor -sql = SELECT * FROM device WHERE no=? LIMIT 0, 1 , tables = [device] ***| 11-30 14:00:17 [worker-3-4] DEBUG org.nutz.plugins.cache.dao.CachedNutDaoExecutor -KEY=-75171055:1:1:SELECT * FROM device WHERE no=? LIMIT 0, 1 :test1125 SQL=SELECT * FROM device WHERE no=? LIMIT 0, 1 ***| 11-30 14:00:17 [worker-3-4] DEBUG org.nutz.plugins.cache.dao.CachedNutDaoExecutor -cache found key=-75171055:1:1:SELECT * FROM device WHERE no=? LIMIT 0, 1 :test1125 | 11-30 14:00:17 [worker-3-4] DEBUG org.nutz.plugins.cache.dao.CachedNutDaoExecutor -sql = SELECT * FROM device_alerttype WHERE deviceNo=? AND isDeleted=?, tables = [device_alerttype] | 11-30 14:00:17 [worker-3-4] DEBUG org.nutz.plugins.cache.dao.CachedNutDaoExecutor -KEY=-1656150808:_:_:SELECT * FROM device_alerttype WHERE deviceNo=? AND isDeleted=?:test1125:0 SQL=SELECT * FROM device_alerttype WHERE deviceNo=? AND isDeleted=? | 11-30 14:00:17 [worker-3-4] DEBUG org.nutz.plugins.cache.dao.CachedNutDaoExecutor -cache found key=-1656150808:_:_:SELECT * FROM device_alerttype WHERE deviceNo=? AND isDeleted=?:test1125:0 | 11-30 14:00:17 [worker-3-4] DEBUG org.nutz.plugins.cache.dao.CachedNutDaoExecutor -sql = SELECT * FROM devicestatusHistory WHERE deviceNo=? ORDER BY id DESC LIMIT 0, 1 , tables = [devicestatusHistory] | 11-30 14:00:17 [worker-3-4] DEBUG org.nutz.plugins.cache.dao.CachedNutDaoExecutor -KEY=708415648:1:1:SELECT * FROM devicestatusHistory WHERE deviceNo=? ORDER BY id DESC LIMIT 0, 1 :test1125 SQL=SELECT * FROM devicestatusHistory WHERE deviceNo=? ORDER BY id DESC LIMIT 0, 1 | 11-30 14:00:17 [worker-3-4] DEBUG org.nutz.plugins.cache.dao.CachedNutDaoExecutor -cache found key=708415648:1:1:SELECT * FROM devicestatusHistory WHERE deviceNo=? ORDER BY id DESC LIMIT 0, 1 :test1125 | 11-30 14:01:19 [worker-3-4] DEBUG org.nutz.plugins.cache.dao.CachedNutDaoExecutor -sql = SELECT * FROM message WHERE uid=? ORDER BY createTime DESC LIMIT 0, 1 , tables = [message] | 11-30 14:01:19 [worker-3-4] DEBUG org.nutz.plugins.cache.dao.CachedNutDaoExecutor -not good for cache >> SELECT * FROM message WHERE uid=? ORDER BY createTime DESC LIMIT 0, 1 | 11-30 14:01:19 [worker-3-4] DEBUG org.nutz.dao.impl.sql.run.NutDaoExecutor -SELECT * FROM message WHERE uid=? ORDER BY createTime DESC LIMIT 0, 1 | 1 | |----------| | test1125 | For example:> "SELECT * FROM message WHERE uid='test1125' ORDER BY createTime DESC LIMIT 0, 1 " | 11-30 14:01:19 [worker-3-4] DEBUG org.nutz.plugins.cache.dao.CachedNutDaoExecutor -sql = INSERT INTO message(createTime,isDeleted,uid,suid,v,op,od,ky,tm,tms,time,Err,PLC,sta,co,OTA,len,crc,d2,d3,d21,d22,d23,d24,lim_alm,busId) VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?) , tables = [message] | 11-30 14:01:19 [worker-3-4] DEBUG org.nutz.dao.impl.sql.run.NutDaoExecutor -INSERT INTO message(createTime,isDeleted,uid,suid,v,op,od,ky,tm,tms,time,Err,PLC,sta,co,OTA,len,crc,d2,d3,d21,d22,d23,d24,lim_alm,busId) VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?) | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | |---------------------|---|----------|---|---|---|----|----|-------|---------------|------|---|---|---|------|------|------|------|------|------|------|-----|-----|-----|------|------| | 2020-11-30 14:01:14 | 0 | test1125 | 1 | 1 | 3 | 75 | 57 | 19750 | 1606696324544 | NULL | 0 | 0 | 0 | NULL | NULL | NULL | NULL | NULL | NULL | NULL | 0.0 | 0.0 | 0.0 | NULL | NULL | For example:> "INSERT INTO message(createTime,isDeleted,uid,suid,v,op,od,ky,tm,tms,time,Err,PLC,sta,co,OTA,len,crc,d2,d3,d21,d22,d23,d24,lim_alm,busId) VALUES('2020-11-30 14:01:14',0,'test1125',1,1,3,75,57,19750,'1606696324544',NULL,0,'0',0,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0.0,0.0,0.0,NULL,NULL) " | 11-30 14:01:19 [worker-3-4] DEBUG org.nutz.plugins.cache.dao.CachedNutDaoExecutor -Clear Cache=message | 11-30 14:01:19 [worker-3-4] DEBUG org.nutz.plugins.cache.dao.CachedNutDaoExecutor -sql = SELECT * FROM device WHERE no=? LIMIT 0, 1 , tables = [device] ***| 11-30 14:01:19 [worker-3-4] DEBUG org.nutz.plugins.cache.dao.CachedNutDaoExecutor -KEY=-75171055:1:1:SELECT * FROM device WHERE no=? LIMIT 0, 1 :test1125 SQL=SELECT * FROM device WHERE no=? LIMIT 0, 1 ***| 11-30 14:01:19 [worker-3-4] DEBUG org.nutz.plugins.cache.dao.CachedNutDaoExecutor -cache miss = SELECT * FROM device WHERE no=? LIMIT 0, 1 | 11-30 14:01:19 [worker-3-4] DEBUG org.nutz.dao.impl.sql.run.NutDaoExecutor -SELECT * FROM device WHERE no=? LIMIT 0, 1 | 1 | |----------| | test1125 | For example:> "SELECT * FROM device WHERE no='test1125' LIMIT 0, 1 "

看一下行前打星号的,两个相同的sql语句和生成的key值,为什么前一个可以命中缓存,后面的就不行了

4 回复

因为order by

哦, 不是order by. 可能是并发的问题吧, 也可能是事务

测试的时候没有并发而且配置加了enableWhenTrans : true。但是我把事务去掉也会出现这个问题,就是一次命中一次不命中这两种情况交替循环。

那就是有其它操作触发了缓存清除

添加回复
请先登陆
回到顶部