Quellcode durchsuchen

feat:添加删除数据的逻辑

zhaohaipeng vor 1 Monat
Ursprung
Commit
183fcdb78a

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

@@ -87,16 +87,16 @@ public class RedisService implements Serializable {
         for (Map.Entry<String, String> e : batch.entrySet()) {
             // pipeline.setex(e.getKey(), expireSeconds, e.getValue());
             // 压缩后的key,升级后进行替换
-            // try {
-            //     pipeline.setex(e.getKey(), expireSeconds, 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.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.sync();