提交 fb4c6631 编写于 作者: T Terry

fecshop局部缓存的cache key的优化

上级 27ee0004
...@@ -17,7 +17,8 @@ class Footer implements BlockCache ...@@ -17,7 +17,8 @@ class Footer implements BlockCache
public function getCacheKey() public function getCacheKey()
{ {
$lang = Yii::$service->store->currentLangCode; $lang = Yii::$service->store->currentLangCode;
$appName = Yii::$service->helper->getAppName();
return self::BLOCK_CACHE_PREFIX.'_'.$lang; $cacheKeyName = 'footer';
return self::BLOCK_CACHE_PREFIX.'_'.$appName.'_'.$lang.'_'.$cacheKeyName;
} }
} }
...@@ -21,7 +21,8 @@ class Head implements BlockCache ...@@ -21,7 +21,8 @@ class Head implements BlockCache
$controllerId = Yii::$app->controller->id; $controllerId = Yii::$app->controller->id;
$actionId = Yii::$app->controller->action->id; $actionId = Yii::$app->controller->action->id;
$urlPathKey = $moduleId.'_'.$controllerId.'_'.$actionId; $urlPathKey = $moduleId.'_'.$controllerId.'_'.$actionId;
$appName = Yii::$service->helper->getAppName();
return self::BLOCK_CACHE_PREFIX.'_'.$store.'_'.$urlPathKey; $cacheKeyName = 'head';
return self::BLOCK_CACHE_PREFIX.'_'.$store.'_'.$urlPathKey.'_'.$appName.'_'.$cacheKeyName;
} }
} }
...@@ -30,7 +30,8 @@ class Headers implements BlockCache ...@@ -30,7 +30,8 @@ class Headers implements BlockCache
{ {
$lang = Yii::$service->store->currentLangCode; $lang = Yii::$service->store->currentLangCode;
$currency = Yii::$service->page->currency->getCurrentCurrency(); $currency = Yii::$service->page->currency->getCurrentCurrency();
$appName = Yii::$service->helper->getAppName();
return self::BLOCK_CACHE_PREFIX.'_'.$lang.'_'.$currency; $cacheKeyName = 'footer';
return self::BLOCK_CACHE_PREFIX.'_'.$lang.'_'.$currency.'_'.$appName.'_'.$cacheKeyName;
} }
} }
...@@ -19,7 +19,8 @@ class Menu implements BlockCache ...@@ -19,7 +19,8 @@ class Menu implements BlockCache
public function getCacheKey() public function getCacheKey()
{ {
$lang = Yii::$service->store->currentLangCode; $lang = Yii::$service->store->currentLangCode;
$appName = Yii::$service->helper->getAppName();
return self::BLOCK_CACHE_PREFIX.'_'.$lang; $cacheKeyName = 'menu';
return self::BLOCK_CACHE_PREFIX.'_'.$lang.'_'.$appName.'_'.$cacheKeyName;
} }
} }
...@@ -17,7 +17,8 @@ class Footer implements BlockCache ...@@ -17,7 +17,8 @@ class Footer implements BlockCache
public function getCacheKey() public function getCacheKey()
{ {
$lang = Yii::$service->store->currentLangCode; $lang = Yii::$service->store->currentLangCode;
$appName = Yii::$service->helper->getAppName();
return self::BLOCK_CACHE_PREFIX.'_'.$lang; $cacheKeyName = 'footer';
return self::BLOCK_CACHE_PREFIX.'_'.$appName.'_'.$lang.'_'.$cacheKeyName;
} }
} }
...@@ -21,7 +21,8 @@ class Head implements BlockCache ...@@ -21,7 +21,8 @@ class Head implements BlockCache
$controllerId = Yii::$app->controller->id; $controllerId = Yii::$app->controller->id;
$actionId = Yii::$app->controller->action->id; $actionId = Yii::$app->controller->action->id;
$urlPathKey = $moduleId.'_'.$controllerId.'_'.$actionId; $urlPathKey = $moduleId.'_'.$controllerId.'_'.$actionId;
$appName = Yii::$service->helper->getAppName();
return self::BLOCK_CACHE_PREFIX.'_'.$store.'_'.$urlPathKey; $cacheKeyName = 'head';
return self::BLOCK_CACHE_PREFIX.'_'.$store.'_'.$urlPathKey.'_'.$appName.'_'.$cacheKeyName;
} }
} }
...@@ -30,7 +30,8 @@ class Headers implements BlockCache ...@@ -30,7 +30,8 @@ class Headers implements BlockCache
{ {
$lang = Yii::$service->store->currentLangCode; $lang = Yii::$service->store->currentLangCode;
$currency = Yii::$service->page->currency->getCurrentCurrency(); $currency = Yii::$service->page->currency->getCurrentCurrency();
$appName = Yii::$service->helper->getAppName();
return self::BLOCK_CACHE_PREFIX.'_'.$lang.'_'.$currency; $cacheKeyName = 'footer';
return self::BLOCK_CACHE_PREFIX.'_'.$lang.'_'.$currency.'_'.$appName.'_'.$cacheKeyName;
} }
} }
...@@ -19,7 +19,8 @@ class Menu implements BlockCache ...@@ -19,7 +19,8 @@ class Menu implements BlockCache
public function getCacheKey() public function getCacheKey()
{ {
$lang = Yii::$service->store->currentLangCode; $lang = Yii::$service->store->currentLangCode;
$appName = Yii::$service->helper->getAppName();
return self::BLOCK_CACHE_PREFIX.'_'.$lang; $cacheKeyName = 'menu';
return self::BLOCK_CACHE_PREFIX.'_'.$lang.'_'.$appName.'_'.$cacheKeyName;
} }
} }
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册