【发布时间】:2011-03-04 17:04:21
【问题描述】:
我的标题中有几个调用 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),
));
}
【问题讨论】:
标签: magento magento-1.4