Recently we were working on speeding up parts of client site which had usual problem of slow page loading caused by complicated configurable products. To solve the problem we were experimenting with extending core Magento caching capabilities.
Magento has built in predifined system of block output caching. Its block abstract has Zend_Cache caching capabilities that can be modified for your own needs. Iām showing here an example of caching whole product view block, however this is just a specific example of how things works, problems are different and requires different approach and solution.
I will start with some external reading and example itself. There is great article on Magento Wiki about this topic, along with category cache example on Magento forums.
With my Inchoo_BlockCaching.rar example module things should be little easier to understand.
Magento block caching depends of three things:
cache_lifetime => cache lifetime in seconds
cache_tags => cache type identifiers primarly used for deleting right cache at the right time
cache_key => cache identyfier
You can simply inject this data into construtor of any Magento block
1.protected function _construct()2.{3.$this->addData(array(4.'cache_lifetime' => 3600,5.'cache_tags' => array(Mage_Catalog_Model_Product::CACHE_TAG),6.'cache_key' => $this->getProduct()->getId(),7.));8.}or if you need some conditional approach like i did in this example define equivalent functions
1.public function getCacheKey(){}2.public function getCacheLifetime(){}3.public function getCacheTags(){

