为车辆信息,挂车信息,企业信息,驾驶员信息的管理做上缓存。redis做mybatis二级缓存
正在显示
1 个修改的文件
包含
11 行增加
和
2 行删除
| @@ -81,14 +81,23 @@ public class RedisCache implements Cache { | @@ -81,14 +81,23 @@ public class RedisCache implements Cache { | ||
| 81 | if ("com.sunyo.wlpt.vehicle.manage.mapper.LandRoadTrailerRecordMapper".equals(id)) { | 81 | if ("com.sunyo.wlpt.vehicle.manage.mapper.LandRoadTrailerRecordMapper".equals(id)) { |
| 82 | // 挂车信息 | 82 | // 挂车信息 |
| 83 | redisTemplate.expire(id.toString(), random(60, 120), TimeUnit.MINUTES); | 83 | redisTemplate.expire(id.toString(), random(60, 120), TimeUnit.MINUTES); |
| 84 | - } else { | 84 | + } |
| 85 | + if ("com.sunyo.wlpt.vehicle.manage.mapper.LandCorporationInfoMapper".equals(id)) { | ||
| 86 | + // 企业信息 | ||
| 87 | + redisTemplate.expire(id.toString(), random(20, 30), TimeUnit.MINUTES); | ||
| 88 | + } | ||
| 89 | + if ("com.sunyo.wlpt.vehicle.manage.mapper.LandRoadDrRecordMapper".equals(id)) { | ||
| 90 | + // 驾驶员信息 | ||
| 91 | + redisTemplate.expire(id.toString(), random(30, 40), TimeUnit.MINUTES); | ||
| 92 | + } | ||
| 93 | + else { | ||
| 85 | // 其他,作为补充 | 94 | // 其他,作为补充 |
| 86 | redisTemplate.expire(id.toString(), random(30, 50), TimeUnit.MINUTES); | 95 | redisTemplate.expire(id.toString(), random(30, 50), TimeUnit.MINUTES); |
| 87 | } | 96 | } |
| 88 | } | 97 | } |
| 89 | 98 | ||
| 90 | /** | 99 | /** |
| 91 | - * | 100 | + * 随机范围值 |
| 92 | */ | 101 | */ |
| 93 | public int random(int low, int high) | 102 | public int random(int low, int high) |
| 94 | { | 103 | { |
-
请 注册 或 登录 后发表评论