yl-backend/src/main/java/com/guwan/backend/face/util/UserRamGroup.java

43 lines
1.2 KiB
Java

package com.guwan.backend.face.util;
import java.util.List;
import java.util.concurrent.ConcurrentHashMap;
public class UserRamGroup {
private static final ConcurrentHashMap<String, UserRamCache> USER_RAM_GROUP_MAP = new ConcurrentHashMap<>();
private static final ConcurrentHashMap<String, String> ORG_CELL_MAP = new ConcurrentHashMap<>();
public static void addCell(String cellId){
UserRamCache cell = new UserRamCache();
USER_RAM_GROUP_MAP.put(cellId,cell);
}
public static void removeCell(String cellId){
USER_RAM_GROUP_MAP.remove(cellId);
}
public static void addUser(UserInfo userInfo, String cellId) {
USER_RAM_GROUP_MAP.get(cellId).addUser(userInfo);
}
public static void removeUser(String faceId, String cellId) {
USER_RAM_GROUP_MAP.get(cellId).removeUser(faceId);
}
public static List<UserInfo> getUserList(String cellId) {
return USER_RAM_GROUP_MAP.get(cellId).getUserList();
}
public static void addOrgId(String orgId,String cellId){
ORG_CELL_MAP.put(orgId,cellId);
}
public static String getOrgCellMap(String orgId) {
return ORG_CELL_MAP.get(orgId);
}
public static void clear(){
USER_RAM_GROUP_MAP.clear();
}
}