From 5d77aac9614c1258bd08905425e7269a7f076f35 Mon Sep 17 00:00:00 2001 From: cmgyqjj Date: Sat, 21 Sep 2024 16:29:24 +0800 Subject: [PATCH 01/15] feature:Support_LRU_User_Info_Cache --- .../cim/route/config/BeanConfig.java | 21 +++++++++++++ .../impl/UserInfoCacheServiceImpl.java | 30 +++++++------------ 2 files changed, 32 insertions(+), 19 deletions(-) diff --git a/cim-forward-route/src/main/java/com/crossoverjie/cim/route/config/BeanConfig.java b/cim-forward-route/src/main/java/com/crossoverjie/cim/route/config/BeanConfig.java index 81b05c90..d4ab3ac2 100644 --- a/cim-forward-route/src/main/java/com/crossoverjie/cim/route/config/BeanConfig.java +++ b/cim-forward-route/src/main/java/com/crossoverjie/cim/route/config/BeanConfig.java @@ -3,6 +3,7 @@ import com.crossoverjie.cim.common.metastore.MetaStore; import com.crossoverjie.cim.common.metastore.ZkConfiguration; import com.crossoverjie.cim.common.metastore.ZkMetaStoreImpl; +import com.crossoverjie.cim.common.pojo.CIMUserInfo; import com.crossoverjie.cim.common.route.algorithm.RouteHandle; import com.crossoverjie.cim.common.route.algorithm.consistenthash.AbstractConsistentHash; import com.google.common.cache.CacheBuilder; @@ -23,6 +24,8 @@ import java.lang.reflect.Method; import java.util.concurrent.TimeUnit; +import static com.crossoverjie.cim.route.constant.Constant.ACCOUNT_PREFIX; + /** * Function: * @@ -105,4 +108,22 @@ public RouteHandle buildRouteHandle() throws Exception { } } + + @Bean + public LoadingCache USER_INFO_MAP(RedisTemplate redisTemplate) { + return CacheBuilder.newBuilder() + .maximumSize(1024) + .build(new CacheLoader<>() { + @Override + public CIMUserInfo load(Long userId) throws Exception { + CIMUserInfo cimUserInfo = null; + String sendUserName = redisTemplate.opsForValue().get(ACCOUNT_PREFIX + userId); + if (sendUserName.isBlank()) { + sendUserName = "unLoginUser"; + } + cimUserInfo = new CIMUserInfo(userId, sendUserName); + return cimUserInfo; + } + }); + } } diff --git a/cim-forward-route/src/main/java/com/crossoverjie/cim/route/service/impl/UserInfoCacheServiceImpl.java b/cim-forward-route/src/main/java/com/crossoverjie/cim/route/service/impl/UserInfoCacheServiceImpl.java index 6f709a45..84ab72ca 100644 --- a/cim-forward-route/src/main/java/com/crossoverjie/cim/route/service/impl/UserInfoCacheServiceImpl.java +++ b/cim-forward-route/src/main/java/com/crossoverjie/cim/route/service/impl/UserInfoCacheServiceImpl.java @@ -2,6 +2,9 @@ import com.crossoverjie.cim.common.pojo.CIMUserInfo; import com.crossoverjie.cim.route.service.UserInfoCacheService; +import com.google.common.cache.CacheBuilder; +import com.google.common.cache.CacheLoader; +import com.google.common.cache.LoadingCache; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.redis.core.RedisTemplate; import org.springframework.stereotype.Service; @@ -10,6 +13,8 @@ import java.util.Map; import java.util.Set; import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.TimeUnit; import static com.crossoverjie.cim.route.constant.Constant.ACCOUNT_PREFIX; import static com.crossoverjie.cim.route.constant.Constant.LOGIN_STATUS_PREFIX; @@ -25,30 +30,17 @@ @Service public class UserInfoCacheServiceImpl implements UserInfoCacheService { - /** - * todo 本地缓存,为了防止内存撑爆,后期可换为 LRU。 - */ - private final static Map USER_INFO_MAP = new ConcurrentHashMap<>(64) ; - @Autowired private RedisTemplate redisTemplate ; + @Autowired + private LoadingCache USER_INFO_MAP; + @Override public CIMUserInfo loadUserInfoByUserId(Long userId) { - - //优先从本地缓存获取 - CIMUserInfo cimUserInfo = USER_INFO_MAP.get(userId); - if (cimUserInfo != null){ - return cimUserInfo ; - } - - //load redis - String sendUserName = redisTemplate.opsForValue().get(ACCOUNT_PREFIX + userId); - if (sendUserName != null){ - cimUserInfo = new CIMUserInfo(userId,sendUserName) ; - USER_INFO_MAP.put(userId,cimUserInfo) ; - } - + //Retrieve user information using a second-level cache. + CIMUserInfo cimUserInfo = null; + cimUserInfo = USER_INFO_MAP.getUnchecked(userId); return cimUserInfo; } From 9198e925baefc00fb08bfff86c83d20485d0a253 Mon Sep 17 00:00:00 2001 From: cmgyqjj Date: Sat, 21 Sep 2024 16:52:09 +0800 Subject: [PATCH 02/15] feature:Support_LRU_User_Info_Cache --- .../java/com/crossoverjie/cim/route/config/BeanConfig.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/cim-forward-route/src/main/java/com/crossoverjie/cim/route/config/BeanConfig.java b/cim-forward-route/src/main/java/com/crossoverjie/cim/route/config/BeanConfig.java index d4ab3ac2..fe242c73 100644 --- a/cim-forward-route/src/main/java/com/crossoverjie/cim/route/config/BeanConfig.java +++ b/cim-forward-route/src/main/java/com/crossoverjie/cim/route/config/BeanConfig.java @@ -9,6 +9,7 @@ import com.google.common.cache.CacheBuilder; import com.google.common.cache.CacheLoader; import com.google.common.cache.LoadingCache; +import com.google.common.cache.Weigher; import lombok.extern.slf4j.Slf4j; import okhttp3.OkHttpClient; import org.I0Itec.zkclient.ZkClient; @@ -22,6 +23,7 @@ import org.springframework.data.redis.serializer.StringRedisSerializer; import java.lang.reflect.Method; +import java.time.Duration; import java.util.concurrent.TimeUnit; import static com.crossoverjie.cim.route.constant.Constant.ACCOUNT_PREFIX; @@ -112,8 +114,11 @@ public RouteHandle buildRouteHandle() throws Exception { @Bean public LoadingCache USER_INFO_MAP(RedisTemplate redisTemplate) { return CacheBuilder.newBuilder() + .initialCapacity(64) .maximumSize(1024) - .build(new CacheLoader<>() { + .concurrencyLevel(Runtime.getRuntime().availableProcessors()) + .expireAfterWrite(10, TimeUnit.MINUTES) + .build(new CacheLoader() { @Override public CIMUserInfo load(Long userId) throws Exception { CIMUserInfo cimUserInfo = null; From ef869cbda6dad3dbeb8917163f91a277fe7d16eb Mon Sep 17 00:00:00 2001 From: cmgyqjj Date: Sat, 21 Sep 2024 17:26:15 +0800 Subject: [PATCH 03/15] feature:Support_LRU_User_Info_Cache --- .../java/com/crossoverjie/cim/route/config/BeanConfig.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cim-forward-route/src/main/java/com/crossoverjie/cim/route/config/BeanConfig.java b/cim-forward-route/src/main/java/com/crossoverjie/cim/route/config/BeanConfig.java index fe242c73..90f3dce0 100644 --- a/cim-forward-route/src/main/java/com/crossoverjie/cim/route/config/BeanConfig.java +++ b/cim-forward-route/src/main/java/com/crossoverjie/cim/route/config/BeanConfig.java @@ -118,12 +118,12 @@ public LoadingCache USER_INFO_MAP(RedisTemplate() { + .build(new CacheLoader() { @Override public CIMUserInfo load(Long userId) throws Exception { CIMUserInfo cimUserInfo = null; String sendUserName = redisTemplate.opsForValue().get(ACCOUNT_PREFIX + userId); - if (sendUserName.isBlank()) { + if (sendUserName == null) { sendUserName = "unLoginUser"; } cimUserInfo = new CIMUserInfo(userId, sendUserName); From 0823d510c63b61f2a3c0e6efdbfddd16a6a270e6 Mon Sep 17 00:00:00 2001 From: cmgyqjj Date: Sat, 21 Sep 2024 20:06:42 +0800 Subject: [PATCH 04/15] feature_Support_LRU_User_Info_Cache --- .../main/java/com/crossoverjie/cim/route/config/BeanConfig.java | 1 + 1 file changed, 1 insertion(+) diff --git a/cim-forward-route/src/main/java/com/crossoverjie/cim/route/config/BeanConfig.java b/cim-forward-route/src/main/java/com/crossoverjie/cim/route/config/BeanConfig.java index f065a515..5414cd84 100644 --- a/cim-forward-route/src/main/java/com/crossoverjie/cim/route/config/BeanConfig.java +++ b/cim-forward-route/src/main/java/com/crossoverjie/cim/route/config/BeanConfig.java @@ -133,6 +133,7 @@ public CIMUserInfo load(Long userId) throws Exception { return cimUserInfo; } }); + } @Bean public ServerApi serverApi(OkHttpClient okHttpClient) { From 8eb336d69fe2d18a1d460b58423dc22313b59290 Mon Sep 17 00:00:00 2001 From: cmgyqjj Date: Sun, 22 Sep 2024 11:12:00 +0800 Subject: [PATCH 05/15] feature_Support_LRU_User_Info_Cache --- .../cim/route/service/impl/UserInfoCacheServiceImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cim-forward-route/src/main/java/com/crossoverjie/cim/route/service/impl/UserInfoCacheServiceImpl.java b/cim-forward-route/src/main/java/com/crossoverjie/cim/route/service/impl/UserInfoCacheServiceImpl.java index 55ec9763..50ffbd14 100644 --- a/cim-forward-route/src/main/java/com/crossoverjie/cim/route/service/impl/UserInfoCacheServiceImpl.java +++ b/cim-forward-route/src/main/java/com/crossoverjie/cim/route/service/impl/UserInfoCacheServiceImpl.java @@ -40,7 +40,7 @@ public class UserInfoCacheServiceImpl implements UserInfoCacheService { @Override public Optional loadUserInfoByUserId(Long userId) { //Retrieve user information using a second-level cache. - CIMUserInfo = USER_INFO_MAP.getUnchecked(userId); + CIMUserInfo cimUserInfo = USER_INFO_MAP.getUnchecked(userId); return Optional.ofNullable(cimUserInfo); } From e4e9135bafc155928500d40d099ad323aa80d9ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8D=BF=E5=98=89=E4=BF=8A?= <47295240+cmgyqjj@users.noreply.github.com> Date: Sun, 22 Sep 2024 17:26:42 +0800 Subject: [PATCH 06/15] Update cim-forward-route/src/main/java/com/crossoverjie/cim/route/service/impl/UserInfoCacheServiceImpl.java Co-authored-by: crossoverJie --- .../cim/route/service/impl/UserInfoCacheServiceImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cim-forward-route/src/main/java/com/crossoverjie/cim/route/service/impl/UserInfoCacheServiceImpl.java b/cim-forward-route/src/main/java/com/crossoverjie/cim/route/service/impl/UserInfoCacheServiceImpl.java index 50ffbd14..abd633ac 100644 --- a/cim-forward-route/src/main/java/com/crossoverjie/cim/route/service/impl/UserInfoCacheServiceImpl.java +++ b/cim-forward-route/src/main/java/com/crossoverjie/cim/route/service/impl/UserInfoCacheServiceImpl.java @@ -34,7 +34,7 @@ public class UserInfoCacheServiceImpl implements UserInfoCacheService { @Autowired private RedisTemplate redisTemplate ; - @Autowired + @Resource(name = "userInfoCache") private LoadingCache USER_INFO_MAP; @Override From 03712e5906a7b0bcecab6cfdfa44d458beb111e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8D=BF=E5=98=89=E4=BF=8A?= <47295240+cmgyqjj@users.noreply.github.com> Date: Sun, 22 Sep 2024 17:26:52 +0800 Subject: [PATCH 07/15] Update cim-forward-route/src/main/java/com/crossoverjie/cim/route/config/BeanConfig.java Co-authored-by: crossoverJie --- .../main/java/com/crossoverjie/cim/route/config/BeanConfig.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cim-forward-route/src/main/java/com/crossoverjie/cim/route/config/BeanConfig.java b/cim-forward-route/src/main/java/com/crossoverjie/cim/route/config/BeanConfig.java index 5414cd84..5461d219 100644 --- a/cim-forward-route/src/main/java/com/crossoverjie/cim/route/config/BeanConfig.java +++ b/cim-forward-route/src/main/java/com/crossoverjie/cim/route/config/BeanConfig.java @@ -115,7 +115,7 @@ public RouteHandle buildRouteHandle() throws Exception { } @Bean - public LoadingCache USER_INFO_MAP(RedisTemplate redisTemplate) { + public LoadingCache userInfoCache(RedisTemplate redisTemplate) { return CacheBuilder.newBuilder() .initialCapacity(64) .maximumSize(1024) From 6b1a1fbb6bf43ae897129e7741ad98076298a269 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8D=BF=E5=98=89=E4=BF=8A?= <47295240+cmgyqjj@users.noreply.github.com> Date: Sun, 22 Sep 2024 17:26:59 +0800 Subject: [PATCH 08/15] Update cim-forward-route/src/main/java/com/crossoverjie/cim/route/config/BeanConfig.java Co-authored-by: crossoverJie --- .../main/java/com/crossoverjie/cim/route/config/BeanConfig.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cim-forward-route/src/main/java/com/crossoverjie/cim/route/config/BeanConfig.java b/cim-forward-route/src/main/java/com/crossoverjie/cim/route/config/BeanConfig.java index 5461d219..44c0450c 100644 --- a/cim-forward-route/src/main/java/com/crossoverjie/cim/route/config/BeanConfig.java +++ b/cim-forward-route/src/main/java/com/crossoverjie/cim/route/config/BeanConfig.java @@ -114,7 +114,7 @@ public RouteHandle buildRouteHandle() throws Exception { } - @Bean + @Bean("userInfoCache") public LoadingCache userInfoCache(RedisTemplate redisTemplate) { return CacheBuilder.newBuilder() .initialCapacity(64) From 65d0c2daf6bde1aff6b428a1592190d08d0153fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8D=BF=E5=98=89=E4=BF=8A?= <47295240+cmgyqjj@users.noreply.github.com> Date: Sun, 22 Sep 2024 17:27:06 +0800 Subject: [PATCH 09/15] Update cim-forward-route/src/main/java/com/crossoverjie/cim/route/config/BeanConfig.java Co-authored-by: crossoverJie --- .../main/java/com/crossoverjie/cim/route/config/BeanConfig.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cim-forward-route/src/main/java/com/crossoverjie/cim/route/config/BeanConfig.java b/cim-forward-route/src/main/java/com/crossoverjie/cim/route/config/BeanConfig.java index 44c0450c..fd120eeb 100644 --- a/cim-forward-route/src/main/java/com/crossoverjie/cim/route/config/BeanConfig.java +++ b/cim-forward-route/src/main/java/com/crossoverjie/cim/route/config/BeanConfig.java @@ -121,7 +121,7 @@ public LoadingCache userInfoCache(RedisTemplate() { + .build(new CacheLoader<>() { @Override public CIMUserInfo load(Long userId) throws Exception { CIMUserInfo cimUserInfo = null; From 39615429eb4dca7bd3a5c3fe39d6bae8170ab75e Mon Sep 17 00:00:00 2001 From: cmgyqjj Date: Sun, 22 Sep 2024 17:28:40 +0800 Subject: [PATCH 10/15] feature_Support_LRU_User_Info_Cache --- .../cim/route/service/impl/UserInfoCacheServiceImpl.java | 1 + 1 file changed, 1 insertion(+) diff --git a/cim-forward-route/src/main/java/com/crossoverjie/cim/route/service/impl/UserInfoCacheServiceImpl.java b/cim-forward-route/src/main/java/com/crossoverjie/cim/route/service/impl/UserInfoCacheServiceImpl.java index abd633ac..c28d49fd 100644 --- a/cim-forward-route/src/main/java/com/crossoverjie/cim/route/service/impl/UserInfoCacheServiceImpl.java +++ b/cim-forward-route/src/main/java/com/crossoverjie/cim/route/service/impl/UserInfoCacheServiceImpl.java @@ -5,6 +5,7 @@ import com.google.common.cache.CacheBuilder; import com.google.common.cache.CacheLoader; import com.google.common.cache.LoadingCache; +import jakarta.annotation.Resource; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.redis.core.RedisTemplate; import org.springframework.stereotype.Service; From 6e08eb7022e3b04f94833fd799f7dab283028ba9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8D=BF=E5=98=89=E4=BF=8A?= <47295240+cmgyqjj@users.noreply.github.com> Date: Sun, 22 Sep 2024 17:30:09 +0800 Subject: [PATCH 11/15] Update cim-forward-route/src/main/java/com/crossoverjie/cim/route/config/BeanConfig.java Co-authored-by: crossoverJie --- .../main/java/com/crossoverjie/cim/route/config/BeanConfig.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cim-forward-route/src/main/java/com/crossoverjie/cim/route/config/BeanConfig.java b/cim-forward-route/src/main/java/com/crossoverjie/cim/route/config/BeanConfig.java index fd120eeb..f486354d 100644 --- a/cim-forward-route/src/main/java/com/crossoverjie/cim/route/config/BeanConfig.java +++ b/cim-forward-route/src/main/java/com/crossoverjie/cim/route/config/BeanConfig.java @@ -127,7 +127,7 @@ public CIMUserInfo load(Long userId) throws Exception { CIMUserInfo cimUserInfo = null; String sendUserName = redisTemplate.opsForValue().get(ACCOUNT_PREFIX + userId); if (sendUserName == null) { - sendUserName = "unLoginUser"; + return null; } cimUserInfo = new CIMUserInfo(userId, sendUserName); return cimUserInfo; From a727b1b108f9f3ac9967cc8e85dc4fe70c6ec73a Mon Sep 17 00:00:00 2001 From: cmgyqjj Date: Sun, 22 Sep 2024 17:30:31 +0800 Subject: [PATCH 12/15] feature_Support_LRU_User_Info_Cache --- .../cim/route/service/impl/UserInfoCacheServiceImpl.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cim-forward-route/src/main/java/com/crossoverjie/cim/route/service/impl/UserInfoCacheServiceImpl.java b/cim-forward-route/src/main/java/com/crossoverjie/cim/route/service/impl/UserInfoCacheServiceImpl.java index c28d49fd..eadbb52f 100644 --- a/cim-forward-route/src/main/java/com/crossoverjie/cim/route/service/impl/UserInfoCacheServiceImpl.java +++ b/cim-forward-route/src/main/java/com/crossoverjie/cim/route/service/impl/UserInfoCacheServiceImpl.java @@ -36,12 +36,12 @@ public class UserInfoCacheServiceImpl implements UserInfoCacheService { private RedisTemplate redisTemplate ; @Resource(name = "userInfoCache") - private LoadingCache USER_INFO_MAP; + private LoadingCache userInfoMap; @Override public Optional loadUserInfoByUserId(Long userId) { //Retrieve user information using a second-level cache. - CIMUserInfo cimUserInfo = USER_INFO_MAP.getUnchecked(userId); + CIMUserInfo cimUserInfo = userInfoMap.getUnchecked(userId); return Optional.ofNullable(cimUserInfo); } From 4ed3e18bbe680d3316b73b47c731fe29aa297e96 Mon Sep 17 00:00:00 2001 From: cmgyqjj Date: Sun, 22 Sep 2024 17:42:34 +0800 Subject: [PATCH 13/15] feature_Support_LRU_User_Info_Cache --- .../com/crossoverjie/cim/route/config/BeanConfig.java | 9 +++++---- .../cim/route/service/impl/UserInfoCacheServiceImpl.java | 6 +++--- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/cim-forward-route/src/main/java/com/crossoverjie/cim/route/config/BeanConfig.java b/cim-forward-route/src/main/java/com/crossoverjie/cim/route/config/BeanConfig.java index f486354d..8188b120 100644 --- a/cim-forward-route/src/main/java/com/crossoverjie/cim/route/config/BeanConfig.java +++ b/cim-forward-route/src/main/java/com/crossoverjie/cim/route/config/BeanConfig.java @@ -27,6 +27,7 @@ import java.lang.reflect.Method; import java.time.Duration; +import java.util.Optional; import java.util.concurrent.TimeUnit; import static com.crossoverjie.cim.route.constant.Constant.ACCOUNT_PREFIX; @@ -115,7 +116,7 @@ public RouteHandle buildRouteHandle() throws Exception { } @Bean("userInfoCache") - public LoadingCache userInfoCache(RedisTemplate redisTemplate) { + public LoadingCache> userInfoCache(RedisTemplate redisTemplate) { return CacheBuilder.newBuilder() .initialCapacity(64) .maximumSize(1024) @@ -123,14 +124,14 @@ public LoadingCache userInfoCache(RedisTemplate() { @Override - public CIMUserInfo load(Long userId) throws Exception { + public Optional load(Long userId) throws Exception { CIMUserInfo cimUserInfo = null; String sendUserName = redisTemplate.opsForValue().get(ACCOUNT_PREFIX + userId); if (sendUserName == null) { - return null; + return Optional.empty(); } cimUserInfo = new CIMUserInfo(userId, sendUserName); - return cimUserInfo; + return Optional.of(cimUserInfo); } }); } diff --git a/cim-forward-route/src/main/java/com/crossoverjie/cim/route/service/impl/UserInfoCacheServiceImpl.java b/cim-forward-route/src/main/java/com/crossoverjie/cim/route/service/impl/UserInfoCacheServiceImpl.java index eadbb52f..76a1e8b7 100644 --- a/cim-forward-route/src/main/java/com/crossoverjie/cim/route/service/impl/UserInfoCacheServiceImpl.java +++ b/cim-forward-route/src/main/java/com/crossoverjie/cim/route/service/impl/UserInfoCacheServiceImpl.java @@ -36,13 +36,13 @@ public class UserInfoCacheServiceImpl implements UserInfoCacheService { private RedisTemplate redisTemplate ; @Resource(name = "userInfoCache") - private LoadingCache userInfoMap; + private LoadingCache> userInfoMap; @Override public Optional loadUserInfoByUserId(Long userId) { //Retrieve user information using a second-level cache. - CIMUserInfo cimUserInfo = userInfoMap.getUnchecked(userId); - return Optional.ofNullable(cimUserInfo); + Optional cimUserInfo = userInfoMap.getUnchecked(userId); + return cimUserInfo; } @Override From 106a42e039f1504c3ecfb0edf1889a664e70cf07 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8D=BF=E5=98=89=E4=BF=8A?= <47295240+cmgyqjj@users.noreply.github.com> Date: Sun, 22 Sep 2024 18:16:06 +0800 Subject: [PATCH 14/15] Update cim-forward-route/src/main/java/com/crossoverjie/cim/route/config/BeanConfig.java Co-authored-by: crossoverJie --- .../main/java/com/crossoverjie/cim/route/config/BeanConfig.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cim-forward-route/src/main/java/com/crossoverjie/cim/route/config/BeanConfig.java b/cim-forward-route/src/main/java/com/crossoverjie/cim/route/config/BeanConfig.java index 8188b120..d5ae3cd1 100644 --- a/cim-forward-route/src/main/java/com/crossoverjie/cim/route/config/BeanConfig.java +++ b/cim-forward-route/src/main/java/com/crossoverjie/cim/route/config/BeanConfig.java @@ -130,7 +130,7 @@ public Optional load(Long userId) throws Exception { if (sendUserName == null) { return Optional.empty(); } - cimUserInfo = new CIMUserInfo(userId, sendUserName); + CIMUserInfo cimUserInfo = new CIMUserInfo(userId, sendUserName); return Optional.of(cimUserInfo); } }); From dbde9e8376511b6f27227507efc40958572ce210 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8D=BF=E5=98=89=E4=BF=8A?= <47295240+cmgyqjj@users.noreply.github.com> Date: Sun, 22 Sep 2024 18:16:11 +0800 Subject: [PATCH 15/15] Update cim-forward-route/src/main/java/com/crossoverjie/cim/route/config/BeanConfig.java Co-authored-by: crossoverJie --- .../main/java/com/crossoverjie/cim/route/config/BeanConfig.java | 1 - 1 file changed, 1 deletion(-) diff --git a/cim-forward-route/src/main/java/com/crossoverjie/cim/route/config/BeanConfig.java b/cim-forward-route/src/main/java/com/crossoverjie/cim/route/config/BeanConfig.java index d5ae3cd1..d43ba8ea 100644 --- a/cim-forward-route/src/main/java/com/crossoverjie/cim/route/config/BeanConfig.java +++ b/cim-forward-route/src/main/java/com/crossoverjie/cim/route/config/BeanConfig.java @@ -125,7 +125,6 @@ public LoadingCache> userInfoCache(RedisTemplate() { @Override public Optional load(Long userId) throws Exception { - CIMUserInfo cimUserInfo = null; String sendUserName = redisTemplate.opsForValue().get(ACCOUNT_PREFIX + userId); if (sendUserName == null) { return Optional.empty();