lawrencehj
2021-06-23 0acf13445a2e3120f3d3599238401c9f2885d711
src/main/java/com/genersoft/iot/vmp/storager/impl/RedisCatchStorageImpl.java
@@ -10,6 +10,7 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.text.SimpleDateFormat;
import java.util.*;
@SuppressWarnings("rawtypes")
@@ -22,6 +23,7 @@
    @Autowired
    private DeviceChannelMapper deviceChannelMapper;
    private SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
    /**
     * 开始播放时将流存入redis
@@ -91,7 +93,7 @@
     */
    @Override
    public boolean updateMediaInfo(ZLMServerConfig ZLMServerConfig) {
        ZLMServerConfig.setUpdateTime(System.currentTimeMillis());
        ZLMServerConfig.setUpdateTime(format.format(new Date(System.currentTimeMillis())));
        return redis.set(VideoManagerConstants.MEDIA_SERVER_PREFIX, ZLMServerConfig);
    }
@@ -291,4 +293,13 @@
            }
        }
    }
    @Override
    public void outlineForAll() {
        List<Object> onlineDevices = redis.scan(String.format("%S*", VideoManagerConstants.KEEPLIVEKEY_PREFIX));
        for (int i = 0; i < onlineDevices.size(); i++) {
            String key = (String) onlineDevices.get(i);
            redis.del(key);
        }
    }
}