You've already forked FrameTour-BE
修改
This commit is contained in:
@ -44,7 +44,7 @@ public class DeviceRepository {
|
||||
if (null != device) {
|
||||
redisTemplate.opsForValue().set(String.format(DEVICE_CACHE_KEY, deviceNo), JSONObject.toJSONString(device));
|
||||
} else {
|
||||
redisTemplate.opsForValue().set(String.format(DEVICE_CACHE_KEY, deviceNo), "null", 60 * 60L, TimeUnit.SECONDS);
|
||||
redisTemplate.opsForValue().set(String.format(DEVICE_CACHE_KEY, deviceNo), "null", 60L, TimeUnit.SECONDS);
|
||||
}
|
||||
return device;
|
||||
}
|
||||
@ -64,6 +64,18 @@ public class DeviceRepository {
|
||||
return deviceConfig;
|
||||
}
|
||||
|
||||
public boolean clearDeviceCache(String deviceNo) {
|
||||
if (deviceNo == null) {
|
||||
return true;
|
||||
}
|
||||
if (redisTemplate.hasKey(String.format(DEVICE_CACHE_KEY, deviceNo))) {
|
||||
DeviceEntity device = getDeviceByDeviceNo(deviceNo);
|
||||
redisTemplate.delete(String.format(DEVICE_CACHE_KEY, device.getNo()));
|
||||
clearDeviceCache(device.getId());
|
||||
}
|
||||
redisTemplate.delete(String.format(DEVICE_CACHE_KEY, deviceNo));
|
||||
return true;
|
||||
}
|
||||
public boolean clearDeviceCache(Long deviceId) {
|
||||
if (redisTemplate.hasKey(String.format(DEVICE_CACHE_KEY, deviceId))) {
|
||||
DeviceEntity device = getDevice(deviceId);
|
||||
|
@ -52,4 +52,8 @@ public class SourceRepository {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public SourceEntity getSource(Long id) {
|
||||
return sourceMapper.getEntity(id);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user