package org.sxkj.common.cache;
|
|
import org.sxkj.common.enums.RefreshStatusEnum;
|
|
import java.util.concurrent.ConcurrentHashMap;
|
|
/**
|
* 本地状态机缓存数据
|
*/
|
public class CurrentCacheUtils {
|
/**
|
* 实时更新设备的状态
|
*/
|
private static final ConcurrentHashMap<String, String> STATUS_MAP = new ConcurrentHashMap<String, String>();
|
|
|
public static void setValue(String key, String value) {
|
STATUS_MAP.put(key, value);
|
}
|
|
public static String getValue(String key) {
|
return STATUS_MAP.get(key);
|
}
|
|
/**
|
* 设备状态key
|
*
|
* @param deviceSn
|
* @return
|
*/
|
public static String getDeviceKey(String deviceSn) {
|
return RefreshStatusEnum.DEVICE_REFRESH+ deviceSn;
|
}
|
|
/**
|
* 任务状态
|
*
|
* @return
|
*/
|
public static String getJobKey(String areaCode) {
|
return RefreshStatusEnum.JOB_REFRESH + areaCode;
|
}
|
|
|
}
|