作者 王勇

为车辆信息,挂车信息,企业信息,驾驶员信息的管理做上缓存。redis做mybatis二级缓存

... ... @@ -81,14 +81,23 @@ public class RedisCache implements Cache {
if ("com.sunyo.wlpt.vehicle.manage.mapper.LandRoadTrailerRecordMapper".equals(id)) {
// 挂车信息
redisTemplate.expire(id.toString(), random(60, 120), TimeUnit.MINUTES);
} else {
}
if ("com.sunyo.wlpt.vehicle.manage.mapper.LandCorporationInfoMapper".equals(id)) {
// 企业信息
redisTemplate.expire(id.toString(), random(20, 30), TimeUnit.MINUTES);
}
if ("com.sunyo.wlpt.vehicle.manage.mapper.LandRoadDrRecordMapper".equals(id)) {
// 驾驶员信息
redisTemplate.expire(id.toString(), random(30, 40), TimeUnit.MINUTES);
}
else {
// 其他,作为补充
redisTemplate.expire(id.toString(), random(30, 50), TimeUnit.MINUTES);
}
}
/**
*
* 随机范围值
*/
public int random(int low, int high)
{
... ...