瀏覽代碼

Merge remote-tracking branch 'origin/feature-v4-20220801' into feature-v4-20220801

dengsixing 2 年之前
父節點
當前提交
7ddf158a95

+ 1 - 1
4dkankan-utils-rabbitmq/src/main/java/com/fdkankan/rabbitmq/util/RabbitMqProducer.java

@@ -38,7 +38,7 @@ public class RabbitMqProducer {
      * 工作队列模式发送
      */
     public void sendByWorkQueue(String queue, Object content){
-        log.info("开始发送Mq消息,消息内容:{}", new JSONObject(content).toString());
+        log.info("开始发送Mq消息,消息队列:{},消息内容:{}",queue, new JSONObject(content).toString());
         CorrelationData correlationId = new CorrelationData(UUID.randomUUID().toString());
         rabbitTemplate.convertAndSend(queue, content, correlationId);
     }

+ 16 - 1
4dkankan-utils-redis/src/main/java/com/fdkankan/redis/util/RedisUtil.java

@@ -7,7 +7,7 @@ import org.springframework.stereotype.Component;
 import org.springframework.util.CollectionUtils;
 
 import java.time.Duration;
-import java.time.temporal.ChronoUnit;
+import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
@@ -605,6 +605,21 @@ public class RedisUtil<K, V>{
         }
     }
 
+    /**
+     * 移除N个值为value
+     *
+     * @param pattern   键
+     * @return 移除的个数
+     */
+    public Set<String> keys(String pattern) {
+        try {
+            return redisTemplate.keys(pattern);
+        } catch (Exception e) {
+            e.printStackTrace();
+            return new HashSet<>();
+        }
+    }
+
     public void expire(String key,Duration time){
         redisTemplate.expire(key, time);
     }