Toggle navigation
Toggle navigation
This project
Loading...
Sign in
fe
/
yohobuy-node
·
Commits
Go to a project
GitLab
Go to group
Project
Activity
Files
Commits
Pipelines
0
Builds
0
Graphs
Milestones
Issues
1
Merge Requests
0
Members
Labels
Wiki
Forks
Network
Create a new issue
Download as
Plain Diff
Browse Files
Authored by
周少峰
8 years ago
Commit
9bb9a02d48bbae754803a1ded62625ea75f4ed29
2 parents
dfe1c4b5
1a95fed3
Merge branch 'release/hbs' of git.yoho.cn:fe/yohobuy-node into release/hbs
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
2 deletions
config/cache.js
doraemon/middleware/page-cache.js
config/cache.js
View file @
9bb9a02
...
...
@@ -16,8 +16,9 @@ const cachePage = {
'/product/\\/pro_([\\d]+)_([\\d]+)\\/(.*)/'
:
30
*
MINUTE
,
// 逛
'/guang'
:
1
*
MINUTE
,
'/guang
/
'
:
1
*
MINUTE
,
'/guang/info/index'
:
10
*
MINUTE
,
'/guang/detail/:id'
:
10
*
MINUTE
,
'/guang/index/editor'
:
1
*
MINUTE
,
'/guang/tags/index'
:
1
*
MINUTE
,
...
...
@@ -49,7 +50,7 @@ const cachePage = {
'/product/list/new'
:
30
*
SECOND
,
// 品牌一览
'/brands'
:
5
*
MINUTE
,
'/brands
/
'
:
5
*
MINUTE
,
'/brands/plusstar'
:
5
*
MINUTE
,
'/special/(\\d+)_(.*)\\.html'
:
5
*
MINUTE
...
...
doraemon/middleware/page-cache.js
View file @
9bb9a02
...
...
@@ -21,6 +21,11 @@ module.exports = () => {
function
onRender
()
{
let
route
=
req
.
route
?
req
.
route
.
path
:
''
;
let
appPath
=
req
.
app
.
mountpath
;
if
(
_
.
isArray
(
route
)
&&
route
.
length
>
0
)
{
route
=
route
[
0
];
}
let
key
=
urlJoin
(
appPath
,
route
.
toString
());
// route may be a regexp
req
.
app
.
set
(
'etag'
,
false
);
...
...
Please
register
or
login
to post a comment