Reputation: 1325
i cached my custom block inherit of Mage_Core_Block_Template. I cached the bloc with the next constructor:
protected function _construct()
{
$this->addData(array(
'cache_lifetime' => 120,
'cache_tags' => array(Mage_Core_Model_Store::CACHE_TAG, Mage_Cms_Model_Block::CACHE_TAG),
));
}
Right, i want verify that this block is cached. How i can list all block cached in my Magento. I want a similar instruction:
var_dump($this->getLayout()->getUpdate()->getHandles());exit;
to see all layout , in blocks cached. thx.
Upvotes: 2
Views: 2884
Reputation: 666
To see if Magento created your cache, you could search for the file that contains in it's name your tags in the var folder. Also make sure you have your cache activated for this to work.
Upvotes: 0
Reputation: 3655
You can specify cache_key
for your block:
protected function _construct()
{
$this->addData(array(
'cache_key' => 'some_static_or_dynamic_key', // can be static or dynamic
'cache_lifetime' => 120,
'cache_tags' => array(
Mage_Core_Model_Store::CACHE_TAG,
Mage_Cms_Model_Block::CACHE_TAG),
)
);
}
And then you can ensure that block is cached by calling:
Mage::app()->loadCache('your_cache_key');
Here is good article about blocks caching.
Upvotes: 4