Toggle navigation
Toggle navigation
This project
Loading...
Sign in
fe
/
YOHOBUYPC
·
Commits
Go to a project
GitLab
Go to group
Project
Activity
Files
Commits
Pipelines
0
Builds
0
Graphs
Milestones
Issues
0
Merge Requests
2
Members
Labels
Wiki
Forks
Network
Create a new issue
Download as
Email Patches
Plain Diff
Browse Files
Authored by
whb
9 years ago
Commit
8cc8c198196b2c165623947f8a076e790fa69149
1 parent
f60003d4
修改memcache配置
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
9 additions
and
8 deletions
library/LibModels/Web/Guang/PlusstarData.php
library/WebPlugin/Cache.php
yohobuy/www.yohobuy.com/application/models/Guang/Index.php
yohobuy/www.yohobuy.com/application/models/Guang/Plusstar.php
yohobuy/www.yohobuy.com/application/models/Index/Home.php
library/LibModels/Web/Guang/PlusstarData.php
View file @
8cc8c19
...
...
@@ -5,7 +5,7 @@ use Api\Sign;
class
PlusstarData
{
const
URI_BRANDLIST
=
'guang/api/v3/plustar/getlist'
;
/**
/**
* 获取品牌列表
*
* @param int $brandType
...
...
@@ -20,6 +20,7 @@ class PlusstarData {
$param
[
'brand_type'
]
=
$brandType
;
$param
[
'gender'
]
=
$gender
;
$param
[
'client_type'
]
=
$type
;
$param
[
'private_key'
]
=
Yohobuy
::
$privateKeyList
[
$type
];
$param
[
'client_secret'
]
=
Sign
::
getSign
(
$param
);
return
Yohobuy
::
get
(
Yohobuy
::
SERVICE_URL
.
self
::
URI_BRANDLIST
,
$param
);
}
...
...
library/WebPlugin/Cache.php
View file @
8cc8c19
...
...
@@ -33,7 +33,7 @@ class Cache
* @param int $expire 缓存有效期(单位秒, 0表示永久)
* @return void
*/
public
static
function
set
(
$key
,
$value
,
$expire
=
3
6
00
)
public
static
function
set
(
$key
,
$value
,
$expire
=
300
)
{
if
(
USE_CACHE
)
{
try
{
...
...
yohobuy/www.yohobuy.com/application/models/Guang/Index.php
View file @
8cc8c19
...
...
@@ -191,7 +191,7 @@ class IndexModel
//最多取5个
$data
=
array_slice
(
$data
,
0
,
5
);
//格式化数据
Cache
::
set
(
$key
,
$data
,
36
00
);
Cache
::
set
(
$key
,
$data
,
18
00
);
}
}
//master没有数据,资源位没有数据, 取二层缓存
...
...
yohobuy/www.yohobuy.com/application/models/Guang/Plusstar.php
View file @
8cc8c19
...
...
@@ -76,7 +76,7 @@ class PlusstarModel
}
}
if
(
!
empty
(
$articles
))
{
Cache
::
set
(
$key
,
$articles
,
36
00
);
Cache
::
set
(
$key
,
$articles
,
18
00
);
}
}
return
$articles
;
...
...
yohobuy/www.yohobuy.com/application/models/Index/Home.php
View file @
8cc8c19
...
...
@@ -130,7 +130,7 @@ class HomeModel
}
$menu
[]
=
$item
;
}
Cache
::
set
(
$key
,
$menu
,
36
00
);
Cache
::
set
(
$key
,
$menu
,
18
00
);
}
}
...
...
@@ -234,7 +234,7 @@ class HomeModel
//格式化数据
$data
=
ChannelProcess
::
getFormat
(
$channel
,
$resource
[
'data'
]);
//设置master,slave
Cache
::
set
(
$key
,
$data
,
3600
);
Cache
::
set
(
$key
,
$data
);
//清空变量
$resource
=
array
();
}
...
...
@@ -333,7 +333,7 @@ class HomeModel
$result
[]
=
$val
;
}
}
Cache
::
set
(
$key
,
$result
,
3600
);
Cache
::
set
(
$key
,
$result
);
}
// 当一级缓存失效,并且接口异常时, 尝试从二级缓存获取数据
if
(
empty
(
$result
))
{
...
...
@@ -396,7 +396,7 @@ class HomeModel
$val
[
'num'
]
=
$resources
[
$channel
][
'total'
];
}
}
Cache
::
set
(
$key
,
$list
,
36
00
);
Cache
::
set
(
$key
,
$list
,
18
00
);
}
}
// 当一级缓存失效,并且接口异常时, 尝试从二级缓存获取数据
...
...
Please
register
or
login
to post a comment