From 2c160e0e39564dc7a5fbb9a9e46b19492daa0ed9 Mon Sep 17 00:00:00 2001 From: fayel Date: Thu, 14 Sep 2023 15:41:31 +0800 Subject: [PATCH] Delete UserSummary cache after modifying user info --- .../abin/mallchat/common/user/service/cache/UserCache.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/mallchat-chat-server/src/main/java/com/abin/mallchat/common/user/service/cache/UserCache.java b/mallchat-chat-server/src/main/java/com/abin/mallchat/common/user/service/cache/UserCache.java index 819773f..0705d17 100644 --- a/mallchat-chat-server/src/main/java/com/abin/mallchat/common/user/service/cache/UserCache.java +++ b/mallchat-chat-server/src/main/java/com/abin/mallchat/common/user/service/cache/UserCache.java @@ -39,6 +39,8 @@ public class UserCache { private RoleDao roleDao; @Autowired private UserRoleDao userRoleDao; + @Autowired + private UserSummaryCache userSummaryCache; public Long getOnlineNum() { String onlineKey = RedisKey.getKey(RedisKey.ONLINE_UID_ZET); @@ -137,6 +139,8 @@ public class UserCache { public void userInfoChange(Long uid) { delUserInfo(uid); + //删除UserSummaryCache,前端下次懒加载的时候可以获取到最新的数据 + userSummaryCache.delete(uid); refreshUserModifyTime(uid); }