我的标题中有几次对Mage的调用,以获得目录目录模型,并获得一组项目。
我的问题是,这似乎使我的页面两倍的速度,即使HTML块缓存在管理打开。
我以为我能用的是:
$cache = Mage::getSingleton('core/cache');
因此,可以缓存对Mage的调用,例如:
$newCarCollection = Mage::getModel('catalog/category')->load(11)->getProductCollection()->setPageSize(6);
$newCarCollection = $newCarCollection->getItems();
$cache = Mage::getSingleton('core/cache');
$cache->save($newCarCollection, "car_collection", array("car_cache"), 140);
$cache->load("car_collection");这根本行不通。
这是可以做到的,还是我刚刚编造出来的?
谢谢
更新:
function __construct()
{
$this->addData(array(
'cache_lifetime' => 3600,
'cache_tags' => array(Mage_Catalog_Model_Category::CACHE_TAG, Mage_Core_Model_Store_Group::CACHE_TAG),
));
}发布于 2011-03-02 19:20:09
需要为每种块类型以及admin中的选项启用块缓存。
http://www.magentocommerce.com/wiki/development/block_cache_and_html_ouput
如果这样做有效,它将比缓存产品对象更有效。
https://stackoverflow.com/questions/5171122
复制相似问题