Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save jrodriguez-ifuelinteractive/a4ccfcff50a1578d88b6 to your computer and use it in GitHub Desktop.
Save jrodriguez-ifuelinteractive/a4ccfcff50a1578d88b6 to your computer and use it in GitHub Desktop.
Category Block Cache
<?php
class Ifuel_Cache_Block_Catalog_Category_View extends Mage_Catalog_Block_Category_View
{
protected function _construct()
{
$this->addData(array(
// Long term block
'cache_lifetime' => 999999999,
'cache_tags' => array(Mage_Catalog_Model_Product::CACHE_TAG, Mage_Catalog_Model_Category::CACHE_TAG),
));
}
public function getCacheKey()
{
return
'CATEGORY_CACHE' .
md5(Mage::app()->getStore()->getWebsiteId() .
'_' .
Mage::helper('customer')->isLoggedIn() .
'_' .
Mage::helper('core/url')->getCurrentUrl());
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment