diff --git a/src/main/java/com/genersoft/iot/vmp/storager/impl/RedisCatchStorageImpl.java b/src/main/java/com/genersoft/iot/vmp/storager/impl/RedisCatchStorageImpl.java index 4d478c44..b5307c44 100755 --- a/src/main/java/com/genersoft/iot/vmp/storager/impl/RedisCatchStorageImpl.java +++ b/src/main/java/com/genersoft/iot/vmp/storager/impl/RedisCatchStorageImpl.java @@ -239,31 +239,33 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { @Override public void updateStreamAuthorityInfo(String app, String stream, StreamAuthorityInfo streamAuthorityInfo) { - String key = VideoManagerConstants.MEDIA_STREAM_AUTHORITY + userSetting.getServerId() + "_" + app+ "_" + stream; - redisTemplate.opsForValue().set(key, streamAuthorityInfo); + String key = VideoManagerConstants.MEDIA_STREAM_AUTHORITY + userSetting.getServerId(); + String objectKey = app+ "_" + stream; + redisTemplate.opsForHash().put(key, objectKey, streamAuthorityInfo); } @Override public void removeStreamAuthorityInfo(String app, String stream) { - String key = VideoManagerConstants.MEDIA_STREAM_AUTHORITY + userSetting.getServerId() + "_" + app+ "_" + stream ; - redisTemplate.delete(key); + String key = VideoManagerConstants.MEDIA_STREAM_AUTHORITY + userSetting.getServerId(); + String objectKey = app+ "_" + stream; + redisTemplate.opsForHash().delete(key, objectKey); } @Override public StreamAuthorityInfo getStreamAuthorityInfo(String app, String stream) { - String key = VideoManagerConstants.MEDIA_STREAM_AUTHORITY + userSetting.getServerId() + "_" + app+ "_" + stream ; - return JsonUtil.redisJsonToObject(redisTemplate, key, StreamAuthorityInfo.class); + String key = VideoManagerConstants.MEDIA_STREAM_AUTHORITY + userSetting.getServerId(); + String objectKey = app+ "_" + stream; + return (StreamAuthorityInfo)redisTemplate.opsForHash().get(key, objectKey); } @Override public List getAllStreamAuthorityInfo() { - String scanKey = VideoManagerConstants.MEDIA_STREAM_AUTHORITY + userSetting.getServerId() + "_*_*" ; + String key = VideoManagerConstants.MEDIA_STREAM_AUTHORITY + userSetting.getServerId(); List result = new ArrayList<>(); - List keys = RedisUtil.scan(redisTemplate, scanKey); - for (Object o : keys) { - String key = (String) o; - result.add(JsonUtil.redisJsonToObject(redisTemplate, key, StreamAuthorityInfo.class)); + List values = redisTemplate.opsForHash().values(key); + for (Object value : values) { + result.add((StreamAuthorityInfo)value); } return result; }