记得上下班打卡 | git大法好,push需谨慎
Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
liquidnet-bus-v1
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
董敬伟
liquidnet-bus-v1
Commits
7b1b0bcf
Commit
7b1b0bcf
authored
Jan 08, 2025
by
wangyifan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
缓存改造- sweet:user:applet:mobile 增加缓存过期时间
parent
0018358e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
2 deletions
+15
-2
WechatUsersRedisUtils.java
.../liquidnet/service/sweet/utils/WechatUsersRedisUtils.java
+15
-2
No files found.
liquidnet-bus-service/liquidnet-service-sweet/src/main/java/com/liquidnet/service/sweet/utils/WechatUsersRedisUtils.java
View file @
7b1b0bcf
...
...
@@ -75,7 +75,20 @@ public class WechatUsersRedisUtils {
String
redisKey
=
SweetConstant
.
REDIS_KEY_SWEET_APPLET_USERS_PHONE
.
concat
(
mobile
);
Object
obj
=
redisUtil
.
get
(
redisKey
);
if
(
null
==
obj
)
{
return
null
;
// 从MySQL数据库查询
LambdaQueryWrapper
<
SweetAppletUsers
>
lambda
=
new
QueryWrapper
<
SweetAppletUsers
>()
.
lambda
()
.
eq
(
SweetAppletUsers:
:
getPhoneNumber
,
mobile
)
.
orderByDesc
(
SweetAppletUsers:
:
getUpdatedAt
);
List
<
SweetAppletUsers
>
sweetAppletUsers
=
sweetAppletUsersMapper
.
selectList
(
lambda
);
if
(!
CollectionUtils
.
isEmpty
(
sweetAppletUsers
))
{
SweetAppletUsersVo
usersVo
=
SweetAppletUsersVo
.
getNew
();
BeanUtils
.
copyProperties
(
sweetAppletUsers
.
get
(
0
),
usersVo
);
setSweetAppletUsers
(
usersVo
);
return
usersVo
;
}
else
{
return
null
;
}
}
else
{
SweetAppletUsersVo
sweetAppletUsersVo
=
(
SweetAppletUsersVo
)
obj
;
return
sweetAppletUsersVo
;
...
...
@@ -108,7 +121,7 @@ public class WechatUsersRedisUtils {
public
void
setSweetAppletUsers
(
SweetAppletUsersVo
sweetAppletUsersVo
)
{
String
redisKey
=
SweetConstant
.
REDIS_KEY_SWEET_APPLET_USERS_PHONE
.
concat
(
sweetAppletUsersVo
.
getPurePhoneNumber
());
redisUtil
.
set
(
redisKey
,
sweetAppletUsersVo
);
redisUtil
.
set
(
redisKey
,
sweetAppletUsersVo
,
RedisKeyExpireConst
.
SWEET_USER_APPLET_MOBILE_EXPIRE
);
String
redisKeyU
=
SweetConstant
.
REDIS_KEY_SWEET_APPLET_USERS_UNIONID
.
concat
(
sweetAppletUsersVo
.
getUnionId
());
redisUtil
.
set
(
redisKeyU
,
sweetAppletUsersVo
,
RedisKeyExpireConst
.
SWEET_USER_APPLET_UNIONID_EXPIRE
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment