Toggle navigation
Toggle navigation
This project
Loading...
Sign in
fe
/
YOHOBUYWAP
·
Commits
Go to a project
GitLab
Go to group
Project
Activity
Files
Commits
Pipelines
0
Builds
0
Graphs
Milestones
Issues
0
Merge Requests
0
Members
Labels
Wiki
Forks
Network
Create a new issue
Download as
Email Patches
Plain Diff
Browse Files
Authored by
whb
9 years ago
Commit
05d422789a5d38a7ec5787ae3d68fdaa4da10900
1 parent
b711bbee
web缓存字段
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
21 additions
and
22 deletions
library/Configs/WebCacheConfig.php
library/WebPlugin/DataProcess/Process.php
yohobuy/www.yohobuy.com/application/controllers/Common.php
yohobuy/www.yohobuy.com/application/models/Index/Home.php
library/Configs/WebCacheConfig.php
View file @
05d4227
<?php
namespace
Configs
;
/**
* 缓存配置文件
*/
class
WebCacheConfig
{
const
KEY_WEB_HOME_NAVBAR_DATA
=
'key_web_home_navbar_data'
;
//web的导航数据
const
KEY_WEB_HOME_CHANNEL_DATA
=
'key_web_home_channel_data'
;
//web首页频道数据[boys, girls, kids, lifestyle]
const
KEY_WEB_HOME_CHANNEL_NEWARRIVAL_DATA
=
'key_web_home_newarrival_data'
;
//web频道最新上架数据[boys, girls, kids, lifestyle]
const
KEY_WEB_PRODUCT_SEARCH_DATA
=
'key_web_product_search_data'
;
// web搜索的数据
}
<?php
namespace
Configs
;
/**
* 缓存配置文件
*/
class
WebCacheConfig
{
const
KEY_WEB_INDEX_BRANDS_LIST_DATA
=
'key_web_index_brands_list_data'
;
//频道brands数据
const
KEY_WEB_HOME_NAVBAR_DATA
=
'key_web_home_navbar_data'
;
//web的导航数据
const
KEY_WEB_HOME_CHANNEL_DATA
=
'key_web_home_channel_data'
;
//web首页频道数据[boys, girls, kids, lifestyle]
const
KEY_WEB_HOME_CHANNEL_NEWARRIVAL_DATA
=
'key_web_home_newarrival_data'
;
//web频道最新上架数据[boys, girls, kids, lifestyle]
const
KEY_WEB_PRODUCT_SEARCH_DATA
=
'key_web_product_search_data'
;
// web搜索的数据
}
...
...
library/WebPlugin/DataProcess/Process.php
View file @
05d4227
...
...
@@ -4,7 +4,7 @@ namespace WebPlugin\DataProcess;
use
WebPlugin\Images
;
use
WebPlugin\Helpers
;
use
WebPlugin\Cache
;
use
Configs\CacheConfig
;
use
Configs\
Web
CacheConfig
;
use
LibModels\Web\Product\SearchData
;
/**
...
...
@@ -488,7 +488,7 @@ class Process
unset
(
$data
[
$key
+
3
]);
}
$type_key
=
sprintf
(
"%s_%s"
,
$type
,
$key
+
2
);
$cacheKey
=
sprintf
(
"%s_%s"
,
CacheConfig
::
KEY
_INDEX_BRANDS_LIST_DATA
,
$type_key
);
$cacheKey
=
sprintf
(
"%s_%s"
,
WebCacheConfig
::
KEY_WEB
_INDEX_BRANDS_LIST_DATA
,
$type_key
);
Cache
::
set
(
$cacheKey
,
$floor
,
86400
);
$result
[
'preferenceBrands'
][
'brandUrl'
]
=
'/common/getIndexResourceBrand?type='
.
$type_key
;
unset
(
$data
[
$key
],
$data
[
$key
+
1
],
$data
[
$key
+
2
]);
...
...
@@ -869,7 +869,7 @@ class Process
}
$floor
[
'moreBrand'
]
=
'http://yohobuy.com/brands'
;
$type_key
=
sprintf
(
"%s_%s"
,
$type
,
$key
);
$cacheKey
=
sprintf
(
"%s_%s"
,
CacheConfig
::
KEY
_INDEX_BRANDS_LIST_DATA
,
$type_key
);
$cacheKey
=
sprintf
(
"%s_%s"
,
WebCacheConfig
::
KEY_WEB
_INDEX_BRANDS_LIST_DATA
,
$type_key
);
Cache
::
set
(
$cacheKey
,
$floor
,
86400
);
$result
[
'hotBrands'
][
'brandUrl'
]
=
'/common/getIndexResourceBrand?type='
.
$type_key
;
}
...
...
yohobuy/www.yohobuy.com/application/controllers/Common.php
View file @
05d4227
...
...
@@ -3,7 +3,7 @@ use Action\WebAction;
use
Index\HomeModel
;
use
LibModels\Web\Home\IndexData
;
use
WebPlugin\Cache
;
use
Configs\CacheConfig
;
use
Configs\
Web
CacheConfig
;
use
Api\Yohobuy
;
use
WebPlugin\Images
;
use
WebPlugin\Helpers
;
...
...
@@ -20,7 +20,7 @@ class CommonController extends WebAction
$type
=
$this
->
get
(
'type'
);
$data
=
array
();
if
(
!
empty
(
$type
))
{
$key
=
CacheConfig
::
KEY
_INDEX_BRANDS_LIST_DATA
.
'_'
.
$type
;
$key
=
WebCacheConfig
::
KEY_WEB
_INDEX_BRANDS_LIST_DATA
.
'_'
.
$type
;
// array('logoBrand'=>'','moreBrand'=>'')
$data
=
Cache
::
get
(
$key
);
}
...
...
yohobuy/www.yohobuy.com/application/models/Index/Home.php
View file @
05d4227
...
...
@@ -2,7 +2,6 @@
namespace
Index
;
use
Configs\WebCacheConfig
;
use
Configs\ChannelConfig
;
use
WebPlugin\Helpers
;
use
WebPlugin\Cache
;
use
LibModels\Web\Home\IndexData
;
...
...
Please
register
or
login
to post a comment