|
@@ -4,6 +4,8 @@ import cn.hutool.core.util.ArrayUtil;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.fdkk.fdkkmeta.domain.po.ActionPO;
|
|
import com.fdkk.fdkkmeta.domain.po.ActionPO;
|
|
|
|
|
|
|
|
|
|
+import com.fdkk.fdkkmeta.grpc.MetaDataFrameReply;
|
|
|
|
|
+import com.google.protobuf.ProtocolStringList;
|
|
|
import org.springframework.stereotype.Component;
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
|
|
|
import java.util.*;
|
|
import java.util.*;
|
|
@@ -39,9 +41,12 @@ public class MapCacheUtil {
|
|
|
if (ActionCache.containsKey(k)){
|
|
if (ActionCache.containsKey(k)){
|
|
|
List<ActionPO> o = ActionCache.get(k);
|
|
List<ActionPO> o = ActionCache.get(k);
|
|
|
ArrayList<ActionPO> p = new ArrayList<>(o);
|
|
ArrayList<ActionPO> p = new ArrayList<>(o);
|
|
|
- p.subList(sIndex,eIndex+1).clear();
|
|
|
|
|
|
|
+ if (p.size()>1){
|
|
|
|
|
+ p.subList(sIndex,eIndex+1).clear();
|
|
|
|
|
+ }else {
|
|
|
|
|
+ p.clear();
|
|
|
|
|
+ }
|
|
|
ActionCache.put(k, p);
|
|
ActionCache.put(k, p);
|
|
|
-
|
|
|
|
|
}else {
|
|
}else {
|
|
|
throw new RuntimeException("对象不存在");
|
|
throw new RuntimeException("对象不存在");
|
|
|
}
|
|
}
|
|
@@ -55,24 +60,9 @@ public class MapCacheUtil {
|
|
|
ActionPO actionPO=new ActionPO();
|
|
ActionPO actionPO=new ActionPO();
|
|
|
actionPO.setUser_id("1");
|
|
actionPO.setUser_id("1");
|
|
|
MapCacheUtil.appendCacheList("test",actionPO);
|
|
MapCacheUtil.appendCacheList("test",actionPO);
|
|
|
- actionPO=new ActionPO();
|
|
|
|
|
- actionPO.setUser_id("2");
|
|
|
|
|
-
|
|
|
|
|
- MapCacheUtil.appendCacheList("test",actionPO);
|
|
|
|
|
- actionPO=new ActionPO();
|
|
|
|
|
- actionPO.setUser_id("3");
|
|
|
|
|
-
|
|
|
|
|
- MapCacheUtil.appendCacheList("test",actionPO);
|
|
|
|
|
- actionPO=new ActionPO();
|
|
|
|
|
- actionPO.setUser_id("4");
|
|
|
|
|
- MapCacheUtil.appendCacheList("test",actionPO);
|
|
|
|
|
- actionPO=new ActionPO();
|
|
|
|
|
- actionPO.setUser_id("5");
|
|
|
|
|
- MapCacheUtil.appendCacheList("test",actionPO);
|
|
|
|
|
System.out.println(MapCacheUtil.ActionCache.get("test"));
|
|
System.out.println(MapCacheUtil.ActionCache.get("test"));
|
|
|
- MapCacheUtil.removeCache("test",0,2);
|
|
|
|
|
|
|
+ MapCacheUtil.removeCache("test",0,1);
|
|
|
System.out.println(MapCacheUtil.ActionCache.get("test"));
|
|
System.out.println(MapCacheUtil.ActionCache.get("test"));
|
|
|
System.out.println("end");
|
|
System.out.println("end");
|
|
|
-
|
|
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|