Просмотр исходного кода

feat:添加删除数据的逻辑

zhaohaipeng 1 месяц назад
Родитель
Сommit
bf06ce5745

+ 1 - 14
recommend-feature-produce/src/main/java/com/tzld/piaoquan/recommend/feature/produce/service/RedisService.java

@@ -1,7 +1,6 @@
 package com.tzld.piaoquan.recommend.feature.produce.service;
 
 import com.tzld.piaoquan.recommend.feature.produce.model.DTSConfig;
-import com.tzld.piaoquan.recommend.feature.produce.util.CompressionUtil;
 import com.tzld.piaoquan.recommend.feature.produce.util.JSONUtils;
 import org.apache.commons.collections.CollectionUtils;
 import org.apache.commons.collections.MapUtils;
@@ -10,7 +9,6 @@ import redis.clients.jedis.Jedis;
 import redis.clients.jedis.Pipeline;
 
 import java.io.Serializable;
-import java.nio.charset.StandardCharsets;
 import java.util.HashMap;
 import java.util.Iterator;
 import java.util.List;
@@ -85,18 +83,7 @@ public class RedisService implements Serializable {
 
         Pipeline pipeline = jedis.pipelined();
         for (Map.Entry<String, String> e : batch.entrySet()) {
-            // pipeline.setex(e.getKey(), expireSeconds, e.getValue());
-            // 压缩后的key,升级后进行替换
-            try {
-                pipeline.setex(e.getKey(), 10, CompressionUtil.snappyCompress(e.getValue()));
-            } catch (Exception ex) {
-            }
-
-            // try {
-            //     String newKey = String.format("%s:v2", e.getKey());
-            //     pipeline.setex(newKey.getBytes(StandardCharsets.UTF_8), expireSeconds, CompressionUtil.snappyCompressV2(e.getValue()));
-            // } catch (Exception ignore) {
-            // }
+            pipeline.del(e.getKey());
         }
         pipeline.sync();