I rewrite catalog product list block for caching issue. Please review code and give your advices to improve caching and cache-validating issues for huge product listing category pages. Who has better configuration for caching blocks like this?
class Ssd_Fix_Block_Catalog_Product_List extends Mage_Catalog_Block_Product_List
{
const CACHE_TAG = 'CATEGORY_PRODUCTS';
public function getCacheKey()
{
$url = md5(Mage::app()->getRequest()->getOriginalRequest()->getRequestUri());
if (!$this->_cache_key) {
$key = "CATEGORY_PRODUCTS_" . $url;
$this->_cache_key = $key;
}
return $this->_cache_key;
}
public function getCacheTags()
{
$data = array(self::CACHE_TAG);
if ($category = Mage::registry('current_category')) {
$data[] = Mage_Catalog_Model_Category::CACHE_TAG . "_" . $category->getId();
}
if (count($products = $this->getProductList())) {
foreach ($products as $p) {
$data[] = Mage_Catalog_Model_Product::CACHE_TAG . "_" . $p->getId();
}
}
return $data;
}
public function getCacheLifetime()
{
return 60 * 60 * 24;
}
//other methods here
}