Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Z
zhichan
Overview
Overview
Details
Activity
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
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
蒋勇
zhichan
Commits
74d9e376
Commit
74d9e376
authored
Aug 05, 2020
by
linboxuan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add cache.base buildCache function
parent
9ad21e81
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
1 deletions
+18
-1
center-app/app/base/db/cache.base.js
+15
-0
center-app/app/base/utils/businessManager/opPlatformUtils.js
+3
-1
No files found.
center-app/app/base/db/cache.base.js
View file @
74d9e376
...
@@ -37,6 +37,21 @@ class CacheBase {
...
@@ -37,6 +37,21 @@ class CacheBase {
return
JSON
.
parse
(
cacheValue
);
return
JSON
.
parse
(
cacheValue
);
}
}
}
}
async
buildCache
(
inputkey
,
val
,
ex
,
...
items
)
{
const
cachekey
=
this
.
prefix
+
inputkey
;
var
objval
=
await
this
.
buildCacheVal
(
cachekey
,
inputkey
,
val
,
ex
,
...
items
);
if
(
!
objval
||
(
objval
.
status
&&
objval
.
status
!=
0
))
{
return
objval
;
}
if
(
ex
)
{
await
this
.
redisClient
.
setWithEx
(
cachekey
,
JSON
.
stringify
(
objval
),
ex
);
}
else
{
await
this
.
redisClient
.
set
(
cachekey
,
JSON
.
stringify
(
objval
));
}
//缓存当前应用所有的缓存key及其描述
this
.
redisClient
.
sadd
(
this
.
cacheCacheKeyPrefix
,
[
cachekey
+
"|"
+
this
.
desc
]);
return
objval
;
}
async
getCache
(
inputkey
,
ex
)
{
async
getCache
(
inputkey
,
ex
)
{
const
cachekey
=
this
.
prefix
+
inputkey
;
const
cachekey
=
this
.
prefix
+
inputkey
;
var
cacheValue
=
await
this
.
redisClient
.
get
(
cachekey
);
var
cacheValue
=
await
this
.
redisClient
.
get
(
cachekey
);
...
...
center-app/app/base/utils/businessManager/opPlatformUtils.js
View file @
74d9e376
...
@@ -354,7 +354,9 @@ class OpPlatformUtils {
...
@@ -354,7 +354,9 @@ class OpPlatformUtils {
// return system.getResultFail(system.reDoLoginFail, "请勿重复登录", { userpin: result.data.userpin || "" });
// return system.getResultFail(system.reDoLoginFail, "请勿重复登录", { userpin: result.data.userpin || "" });
// }
// }
// }
// }
var
result
=
await
cacheManager
[
"AppUserPinByLoginVcodeCache"
].
cache
(
inputkey
,
pobj
,
system
.
exTime
);
// var result = await cacheManager["AppUserPinByLoginVcodeCache"].cache(inputkey, pobj, system.exTime);
// 2020 0805 lin 修改 cache 改为buildCache。buildCache为新增的方法。与cache的区别是 不去get获取 直接走buildCacheVal
var
result
=
await
cacheManager
[
"AppUserPinByLoginVcodeCache"
].
buildCache
(
inputkey
,
pobj
,
system
.
exTime
);
if
(
result
&&
result
.
status
==
0
&&
pobj
.
actionBody
.
reqType
!=
"reg"
)
{
if
(
result
&&
result
.
status
==
0
&&
pobj
.
actionBody
.
reqType
!=
"reg"
)
{
var
userpinKey
=
this
.
getUserPinKey
(
pobj
.
actionBody
.
userpin
);
var
userpinKey
=
this
.
getUserPinKey
(
pobj
.
actionBody
.
userpin
);
this
.
redisClient
.
setWithEx
(
userpinKey
,
JSON
.
stringify
(
result
),
system
.
exTime
);
this
.
redisClient
.
setWithEx
(
userpinKey
,
JSON
.
stringify
(
result
),
system
.
exTime
);
...
...
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