优化心跳和注册时间记录的取值和展示

This commit is contained in:
lin 2026-01-27 12:31:57 +08:00
parent 4067dcf8d1
commit 27b06a84d7
2 changed files with 5 additions and 4 deletions

View File

@ -563,7 +563,7 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage {
for (Device device : deviceList) {
operations.opsForList().rightPush(VideoManagerConstants.DEVICE_KEEPALIVE_PREFIX + device.getDeviceId(), device.getKeepaliveTimeStamp());
// 2. 截取列表只保留最新 100
operations.opsForList().trim((VideoManagerConstants.DEVICE_KEEPALIVE_PREFIX + device.getDeviceId()), -1000, -1);
operations.opsForList().trim((VideoManagerConstants.DEVICE_KEEPALIVE_PREFIX + device.getDeviceId()), -100, -1);
}
return true;
}
@ -580,7 +580,7 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage {
if (count == null) {
count = 20;
}
return longRedisTemplate.opsForList().range(VideoManagerConstants.DEVICE_KEEPALIVE_PREFIX + deviceId, 0, count + 1);
return longRedisTemplate.opsForList().range(VideoManagerConstants.DEVICE_KEEPALIVE_PREFIX + deviceId, -count - 1, -1);
}
@ -599,7 +599,7 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage {
for (Device device : deviceList) {
operations.opsForList().rightPush(VideoManagerConstants.DEVICE_REGISTER_PREFIX + device.getDeviceId(), device.getRegisterTimeStamp());
// 2. 截取列表只保留最新 100
operations.opsForList().trim((VideoManagerConstants.DEVICE_REGISTER_PREFIX + device.getDeviceId()), -1000, -1);
operations.opsForList().trim((VideoManagerConstants.DEVICE_REGISTER_PREFIX + device.getDeviceId()), -100, -1);
}
return true;
}
@ -615,6 +615,6 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage {
if (count == null) {
count = 20;
}
return longRedisTemplate.opsForList().range(VideoManagerConstants.DEVICE_REGISTER_PREFIX + deviceId, 0, count + 1);
return longRedisTemplate.opsForList().range(VideoManagerConstants.DEVICE_REGISTER_PREFIX + deviceId, -count - 1, -1);
}
}

View File

@ -30,6 +30,7 @@
v-if="viewMode === 'table'"
:data="list"
border
stripe
size="mini"
height="400px"
style="width: 100%;"