Authored by whb

web缓存字段

1 -<?php  
2 -  
3 -namespace Configs;  
4 -  
5 -/**  
6 - * 缓存配置文件  
7 - */  
8 -class WebCacheConfig  
9 -{  
10 -  
11 - const KEY_WEB_HOME_NAVBAR_DATA = 'key_web_home_navbar_data';//web的导航数据  
12 - const KEY_WEB_HOME_CHANNEL_DATA = 'key_web_home_channel_data';//web首页频道数据[boys, girls, kids, lifestyle]  
13 - const KEY_WEB_HOME_CHANNEL_NEWARRIVAL_DATA = 'key_web_home_newarrival_data';//web频道最新上架数据[boys, girls, kids, lifestyle]  
14 - const KEY_WEB_PRODUCT_SEARCH_DATA = 'key_web_product_search_data'; // web搜索的数据  
15 -  
16 -} 1 +<?php
  2 +
  3 +namespace Configs;
  4 +
  5 +/**
  6 + * 缓存配置文件
  7 + */
  8 +class WebCacheConfig
  9 +{
  10 + const KEY_WEB_INDEX_BRANDS_LIST_DATA = 'key_web_index_brands_list_data';//频道brands数据
  11 + const KEY_WEB_HOME_NAVBAR_DATA = 'key_web_home_navbar_data';//web的导航数据
  12 + const KEY_WEB_HOME_CHANNEL_DATA = 'key_web_home_channel_data';//web首页频道数据[boys, girls, kids, lifestyle]
  13 + const KEY_WEB_HOME_CHANNEL_NEWARRIVAL_DATA = 'key_web_home_newarrival_data';//web频道最新上架数据[boys, girls, kids, lifestyle]
  14 + const KEY_WEB_PRODUCT_SEARCH_DATA = 'key_web_product_search_data'; // web搜索的数据
  15 +
  16 +}
@@ -4,7 +4,7 @@ namespace WebPlugin\DataProcess; @@ -4,7 +4,7 @@ namespace WebPlugin\DataProcess;
4 use WebPlugin\Images; 4 use WebPlugin\Images;
5 use WebPlugin\Helpers; 5 use WebPlugin\Helpers;
6 use WebPlugin\Cache; 6 use WebPlugin\Cache;
7 -use Configs\CacheConfig; 7 +use Configs\WebCacheConfig;
8 use LibModels\Web\Product\SearchData; 8 use LibModels\Web\Product\SearchData;
9 9
10 /** 10 /**
@@ -488,7 +488,7 @@ class Process @@ -488,7 +488,7 @@ class Process
488 unset($data[$key + 3]); 488 unset($data[$key + 3]);
489 } 489 }
490 $type_key = sprintf("%s_%s", $type, $key + 2); 490 $type_key = sprintf("%s_%s", $type, $key + 2);
491 - $cacheKey = sprintf("%s_%s", CacheConfig::KEY_INDEX_BRANDS_LIST_DATA, $type_key); 491 + $cacheKey = sprintf("%s_%s", WebCacheConfig::KEY_WEB_INDEX_BRANDS_LIST_DATA, $type_key);
492 Cache::set($cacheKey, $floor, 86400); 492 Cache::set($cacheKey, $floor, 86400);
493 $result['preferenceBrands']['brandUrl'] = '/common/getIndexResourceBrand?type=' . $type_key; 493 $result['preferenceBrands']['brandUrl'] = '/common/getIndexResourceBrand?type=' . $type_key;
494 unset($data[$key], $data[$key + 1], $data[$key + 2]); 494 unset($data[$key], $data[$key + 1], $data[$key + 2]);
@@ -869,7 +869,7 @@ class Process @@ -869,7 +869,7 @@ class Process
869 } 869 }
870 $floor['moreBrand'] = 'http://yohobuy.com/brands'; 870 $floor['moreBrand'] = 'http://yohobuy.com/brands';
871 $type_key = sprintf("%s_%s", $type, $key); 871 $type_key = sprintf("%s_%s", $type, $key);
872 - $cacheKey = sprintf("%s_%s", CacheConfig::KEY_INDEX_BRANDS_LIST_DATA, $type_key); 872 + $cacheKey = sprintf("%s_%s", WebCacheConfig::KEY_WEB_INDEX_BRANDS_LIST_DATA, $type_key);
873 Cache::set($cacheKey, $floor, 86400); 873 Cache::set($cacheKey, $floor, 86400);
874 $result['hotBrands']['brandUrl'] = '/common/getIndexResourceBrand?type=' . $type_key; 874 $result['hotBrands']['brandUrl'] = '/common/getIndexResourceBrand?type=' . $type_key;
875 } 875 }
@@ -3,7 +3,7 @@ use Action\WebAction; @@ -3,7 +3,7 @@ use Action\WebAction;
3 use Index\HomeModel; 3 use Index\HomeModel;
4 use LibModels\Web\Home\IndexData; 4 use LibModels\Web\Home\IndexData;
5 use WebPlugin\Cache; 5 use WebPlugin\Cache;
6 -use Configs\CacheConfig; 6 +use Configs\WebCacheConfig;
7 use Api\Yohobuy; 7 use Api\Yohobuy;
8 use WebPlugin\Images; 8 use WebPlugin\Images;
9 use WebPlugin\Helpers; 9 use WebPlugin\Helpers;
@@ -20,7 +20,7 @@ class CommonController extends WebAction @@ -20,7 +20,7 @@ class CommonController extends WebAction
20 $type = $this->get('type'); 20 $type = $this->get('type');
21 $data = array(); 21 $data = array();
22 if (! empty($type)) { 22 if (! empty($type)) {
23 - $key = CacheConfig::KEY_INDEX_BRANDS_LIST_DATA . '_' . $type; 23 + $key = WebCacheConfig::KEY_WEB_INDEX_BRANDS_LIST_DATA . '_' . $type;
24 // array('logoBrand'=>'','moreBrand'=>'') 24 // array('logoBrand'=>'','moreBrand'=>'')
25 $data = Cache::get($key); 25 $data = Cache::get($key);
26 } 26 }
@@ -2,7 +2,6 @@ @@ -2,7 +2,6 @@
2 namespace Index; 2 namespace Index;
3 3
4 use Configs\WebCacheConfig; 4 use Configs\WebCacheConfig;
5 -use Configs\ChannelConfig;  
6 use WebPlugin\Helpers; 5 use WebPlugin\Helpers;
7 use WebPlugin\Cache; 6 use WebPlugin\Cache;
8 use LibModels\Web\Home\IndexData; 7 use LibModels\Web\Home\IndexData;