2

Our headers caching over one another. A solution that i've come up with involves creating and calling these separate cached pages from a non-cached environment. Seems like it'd be a successful endeavor. What is the best way to acomplish this goal?

Is it possible to create a cache key for a block?

1 Answer 1

4

Yes you can cache each of the block in accordance with your need. There are lot of tutorials regarding about this topic. Some of the Best resources available are listing below.

Basically in your block's __construct, you need to setup block cache somewhat liket this.

class {NS}_{Module}_Block_{View} extends Mage_Core_Block_Template 
{

    protected function _construct()
    {
        $this->addData(array(
            'cache_lifetime'    => 120,
            'cache_tags'        => array(Mage_Catalog_Model_Product::CACHE_TAG),
            'cache_key'         => $this->getProduct()->getId(),
        ));
    }   

}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.