From 21066b4d5b9949f5414c71b09c278818016f7e88 Mon Sep 17 00:00:00 2001
From: wayn <1669738430@qq.com>
Date: Sun, 2 May 2021 16:26:08 +0800
Subject: [PATCH] =?UTF-8?q?feat(=E7=A7=BB=E5=8A=A8=E7=AB=AF):=20todo?=
=?UTF-8?q?=E4=BA=8B=E9=A1=B9?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
优化注册页面
---
pom.xml | 2 +-
.../src/main/java/com/wayn/data/redis/config/CacheConfig.java | 2 ++
.../src/main/java/com/wayn/data/redis/manager/RedisCache.java | 1 +
.../main/java/com/wayn/message/reciver/EmailDirectReceiver.java | 2 ++
.../main/java/com/wayn/message/reciver/OrderDirectReceiver.java | 2 ++
5 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/pom.xml b/pom.xml
index d41543f..bd381f9 100644
--- a/pom.xml
+++ b/pom.xml
@@ -33,7 +33,7 @@
2.4.4
8.0.19
3.3.0
- 7.4.2
+ [7.9.2,)
1.18.6
3.4.2
1.2.4
diff --git a/waynboot-data/waynboot-data-redis/src/main/java/com/wayn/data/redis/config/CacheConfig.java b/waynboot-data/waynboot-data-redis/src/main/java/com/wayn/data/redis/config/CacheConfig.java
index fc24997..cd13c00 100644
--- a/waynboot-data/waynboot-data-redis/src/main/java/com/wayn/data/redis/config/CacheConfig.java
+++ b/waynboot-data/waynboot-data-redis/src/main/java/com/wayn/data/redis/config/CacheConfig.java
@@ -63,7 +63,9 @@ public class CacheConfig extends CachingConfigurerSupport {
RedisTemplate redisTemplate = new RedisTemplate<>();
redisTemplate.setConnectionFactory(jedisConnectionFactory);
redisTemplate.setKeySerializer(keySerializer());
+ redisTemplate.setHashKeySerializer(keySerializer());
redisTemplate.setValueSerializer(valueSerializer());
+ redisTemplate.setHashValueSerializer(valueSerializer());
redisTemplate.afterPropertiesSet();
return redisTemplate;
}
diff --git a/waynboot-data/waynboot-data-redis/src/main/java/com/wayn/data/redis/manager/RedisCache.java b/waynboot-data/waynboot-data-redis/src/main/java/com/wayn/data/redis/manager/RedisCache.java
index e78f135..95a8e96 100644
--- a/waynboot-data/waynboot-data-redis/src/main/java/com/wayn/data/redis/manager/RedisCache.java
+++ b/waynboot-data/waynboot-data-redis/src/main/java/com/wayn/data/redis/manager/RedisCache.java
@@ -1,6 +1,7 @@
package com.wayn.data.redis.manager;
import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.annotation.DependsOn;
import org.springframework.data.redis.core.HashOperations;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.core.ValueOperations;
diff --git a/waynboot-message-consumer/src/main/java/com/wayn/message/reciver/EmailDirectReceiver.java b/waynboot-message-consumer/src/main/java/com/wayn/message/reciver/EmailDirectReceiver.java
index 88ee600..6b50561 100644
--- a/waynboot-message-consumer/src/main/java/com/wayn/message/reciver/EmailDirectReceiver.java
+++ b/waynboot-message-consumer/src/main/java/com/wayn/message/reciver/EmailDirectReceiver.java
@@ -20,6 +20,7 @@ import org.springframework.web.client.RestTemplate;
import java.io.IOException;
import java.util.Map;
+import java.util.concurrent.TimeUnit;
@Slf4j
@RabbitListener(queues = "EmailDirectQueue")
@@ -68,6 +69,7 @@ public class EmailDirectReceiver {
// multiple参数:确认收到消息,false只确认当前consumer一个消息收到,true确认所有consumer获得的消息
channel.basicAck(deliveryTag, false);
redisCache.setCacheMapValue("email_consumer_set", msgId, "email has send");
+ redisCache.expire("email_consumer_set", 180, TimeUnit.SECONDS);
} catch (Exception e) {
channel.basicNack(deliveryTag, false, true);
log.error(e.getMessage(), e);
diff --git a/waynboot-message-consumer/src/main/java/com/wayn/message/reciver/OrderDirectReceiver.java b/waynboot-message-consumer/src/main/java/com/wayn/message/reciver/OrderDirectReceiver.java
index fac729a..598132d 100644
--- a/waynboot-message-consumer/src/main/java/com/wayn/message/reciver/OrderDirectReceiver.java
+++ b/waynboot-message-consumer/src/main/java/com/wayn/message/reciver/OrderDirectReceiver.java
@@ -19,6 +19,7 @@ import org.springframework.util.MultiValueMap;
import org.springframework.web.client.RestTemplate;
import java.io.IOException;
+import java.util.concurrent.TimeUnit;
@Slf4j
public class OrderDirectReceiver {
@@ -70,6 +71,7 @@ public class OrderDirectReceiver {
// multiple参数:确认收到消息,false只确认当前consumer一个消息收到,true确认所有consumer获得的消息
channel.basicAck(deliveryTag, false);
redisCache.setCacheMapValue("order_consumer_set", msgId, "order done");
+ redisCache.expire("order_consumer_set", 180, TimeUnit.SECONDS);
} catch (Exception e) {
channel.basicNack(deliveryTag, false, true);
log.error(e.getMessage(), e);