Parcourir la source

更新map缓存

xiewenjie il y a 3 ans
Parent
commit
5d887dca6a
1 fichiers modifiés avec 3 ajouts et 2 suppressions
  1. 3 2
      src/main/java/com/fdkk/fdkkmeta/util/MapCacheUtil.java

+ 3 - 2
src/main/java/com/fdkk/fdkkmeta/util/MapCacheUtil.java

@@ -6,6 +6,7 @@ import com.fdkk.fdkkmeta.domain.po.ActionPO;
 
 
 import com.fdkk.fdkkmeta.grpc.MetaDataFrameReply;
 import com.fdkk.fdkkmeta.grpc.MetaDataFrameReply;
 import com.google.protobuf.ProtocolStringList;
 import com.google.protobuf.ProtocolStringList;
+import org.springframework.scheduling.annotation.EnableAsync;
 import org.springframework.stereotype.Component;
 import org.springframework.stereotype.Component;
 
 
 import java.util.*;
 import java.util.*;
@@ -34,7 +35,7 @@ public class MapCacheUtil {
             ActionCache.put(k, Arrays.asList(v));
             ActionCache.put(k, Arrays.asList(v));
         }
         }
     }
     }
-    public static void removeCache(String k,int sIndex,int eIndex){
+    public static synchronized void removeCache(String k,int sIndex,int eIndex){
         if (ArrayUtil.isArray(ActionCache.get(k))) {
         if (ArrayUtil.isArray(ActionCache.get(k))) {
             throw new RuntimeException("存入对象不是集合");
             throw new RuntimeException("存入对象不是集合");
         }
         }
@@ -44,7 +45,7 @@ public class MapCacheUtil {
             if (p.size()>1){
             if (p.size()>1){
                 p.subList(sIndex,eIndex+1).clear();
                 p.subList(sIndex,eIndex+1).clear();
             }else {
             }else {
-                p.clear();
+                p.subList(sIndex,eIndex).clear();
             }
             }
             ActionCache.put(k, p);
             ActionCache.put(k, p);
         }else {
         }else {