使用冒号分隔redis的key
parent
f1e902af7f
commit
1de344674a
|
@ -50,7 +50,7 @@ public class VideoStreamSessionManager {
|
||||||
ssrcTransaction.setType(type);
|
ssrcTransaction.setType(type);
|
||||||
|
|
||||||
redisTemplate.opsForValue().set(VideoManagerConstants.MEDIA_TRANSACTION_USED_PREFIX + userSetting.getServerId()
|
redisTemplate.opsForValue().set(VideoManagerConstants.MEDIA_TRANSACTION_USED_PREFIX + userSetting.getServerId()
|
||||||
+ "_" + deviceId + "_" + channelId + "_" + callId + "_" + stream, ssrcTransaction);
|
+ ":" + deviceId + ":" + channelId + ":" + callId + ":" + stream, ssrcTransaction);
|
||||||
}
|
}
|
||||||
|
|
||||||
public SsrcTransaction getSsrcTransaction(String deviceId, String channelId, String callId, String stream){
|
public SsrcTransaction getSsrcTransaction(String deviceId, String channelId, String callId, String stream){
|
||||||
|
@ -67,7 +67,7 @@ public class VideoStreamSessionManager {
|
||||||
if (ObjectUtils.isEmpty(stream)) {
|
if (ObjectUtils.isEmpty(stream)) {
|
||||||
stream ="*";
|
stream ="*";
|
||||||
}
|
}
|
||||||
String key = VideoManagerConstants.MEDIA_TRANSACTION_USED_PREFIX + userSetting.getServerId() + "_" + deviceId + "_" + channelId + "_" + callId+ "_" + stream;
|
String key = VideoManagerConstants.MEDIA_TRANSACTION_USED_PREFIX + userSetting.getServerId() + ":" + deviceId + ":" + channelId + ":" + callId+ ":" + stream;
|
||||||
List<Object> scanResult = RedisUtil.scan(redisTemplate, key);
|
List<Object> scanResult = RedisUtil.scan(redisTemplate, key);
|
||||||
if (scanResult.size() == 0) {
|
if (scanResult.size() == 0) {
|
||||||
return null;
|
return null;
|
||||||
|
@ -80,12 +80,12 @@ public class VideoStreamSessionManager {
|
||||||
if (ObjectUtils.isEmpty(callId)) {
|
if (ObjectUtils.isEmpty(callId)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
String key = VideoManagerConstants.MEDIA_TRANSACTION_USED_PREFIX + userSetting.getServerId() + "_*_*_" + callId+ "_*";
|
String key = VideoManagerConstants.MEDIA_TRANSACTION_USED_PREFIX + userSetting.getServerId() + ":*:*:" + callId+ ":*";
|
||||||
List<Object> scanResult = RedisUtil.scan(redisTemplate, key);
|
List<Object> scanResult = RedisUtil.scan(redisTemplate, key);
|
||||||
if (!scanResult.isEmpty()) {
|
if (!scanResult.isEmpty()) {
|
||||||
return (SsrcTransaction)redisTemplate.opsForValue().get(scanResult.get(0));
|
return (SsrcTransaction)redisTemplate.opsForValue().get(scanResult.get(0));
|
||||||
}else {
|
}else {
|
||||||
key = VideoManagerConstants.MEDIA_TRANSACTION_USED_PREFIX + userSetting.getServerId() + "_*_*_play_*";
|
key = VideoManagerConstants.MEDIA_TRANSACTION_USED_PREFIX + userSetting.getServerId() + ":*:*:play:*";
|
||||||
scanResult = RedisUtil.scan(redisTemplate, key);
|
scanResult = RedisUtil.scan(redisTemplate, key);
|
||||||
if (scanResult.isEmpty()) {
|
if (scanResult.isEmpty()) {
|
||||||
return null;
|
return null;
|
||||||
|
@ -115,7 +115,7 @@ public class VideoStreamSessionManager {
|
||||||
if (ObjectUtils.isEmpty(stream)) {
|
if (ObjectUtils.isEmpty(stream)) {
|
||||||
stream ="*";
|
stream ="*";
|
||||||
}
|
}
|
||||||
String key = VideoManagerConstants.MEDIA_TRANSACTION_USED_PREFIX + userSetting.getServerId() + "_" + deviceId + "_" + channelId + "_" + callId+ "_" + stream;
|
String key = VideoManagerConstants.MEDIA_TRANSACTION_USED_PREFIX + userSetting.getServerId() + ":" + deviceId + ":" + channelId + ":" + callId+ ":" + stream;
|
||||||
List<Object> scanResult = RedisUtil.scan(redisTemplate, key);
|
List<Object> scanResult = RedisUtil.scan(redisTemplate, key);
|
||||||
if (scanResult.size() == 0) {
|
if (scanResult.size() == 0) {
|
||||||
return null;
|
return null;
|
||||||
|
@ -149,8 +149,8 @@ public class VideoStreamSessionManager {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
for (SsrcTransaction ssrcTransaction : ssrcTransactionList) {
|
for (SsrcTransaction ssrcTransaction : ssrcTransactionList) {
|
||||||
redisTemplate.delete(VideoManagerConstants.MEDIA_TRANSACTION_USED_PREFIX + userSetting.getServerId() + "_"
|
redisTemplate.delete(VideoManagerConstants.MEDIA_TRANSACTION_USED_PREFIX + userSetting.getServerId() + ":"
|
||||||
+ deviceId + "_" + channelId + "_" + ssrcTransaction.getCallId() + "_" + ssrcTransaction.getStream());
|
+ deviceId + ":" + channelId + ":" + ssrcTransaction.getCallId() + ":" + ssrcTransaction.getStream());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -159,8 +159,8 @@ public class VideoStreamSessionManager {
|
||||||
if (ssrcTransaction == null ) {
|
if (ssrcTransaction == null ) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
redisTemplate.delete(VideoManagerConstants.MEDIA_TRANSACTION_USED_PREFIX + userSetting.getServerId() + "_"
|
redisTemplate.delete(VideoManagerConstants.MEDIA_TRANSACTION_USED_PREFIX + userSetting.getServerId() + ":"
|
||||||
+ deviceId + "_" + channelId + "_" + ssrcTransaction.getCallId() + "_" + ssrcTransaction.getStream());
|
+ deviceId + ":" + channelId + ":" + ssrcTransaction.getCallId() + ":" + ssrcTransaction.getStream());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue