What is the benefit of explicitly specify `short_cache_id` in Magento Block
-
03-10-2020 - |
質問
I can see below code in the class Mage_Catalog_Block_Navigation
atapp/code/core/Mage/Catalog/Block/Navigation.php
public function getCacheKeyInfo()
{
$shortCacheId = array(
'CATALOG_NAVIGATION',
Mage::app()->getStore()->getId(),
Mage::getDesign()->getPackageName(),
Mage::getDesign()->getTheme('template'),
Mage::getSingleton('customer/session')->getCustomerGroupId(),
'template' => $this->getTemplate(),
'name' => $this->getNameInLayout(),
$this->getCurrenCategoryKey()
);
$cacheId = $shortCacheId;
$shortCacheId = array_values($shortCacheId);
$shortCacheId = implode('|', $shortCacheId);
$shortCacheId = md5($shortCacheId);
$cacheId['category_path'] = $this->getCurrenCategoryKey();
$cacheId['short_cache_id'] = $shortCacheId;
return $cacheId;
}
I know that getCacheKeyInfo()
method will generate unique cache key for catalog navigation block. But my doubt is on following section
$cacheId['category_path'] = $this->getCurrenCategoryKey();
$cacheId['short_cache_id'] = $shortCacheId;
What is the benefit of setting category_path
and short_cache_id
in this particular method ?
Someone please enlighten me with this because it seems absurd to me.
解決
In CE, there is no benefit at all.
The short_cache_id
is used in EE in the Full Page Cache module to differentiate the cache id of the left navigation and the cache of the top navigation.
所属していません magento.stackexchange