Reputation: 4022
I have seen the wiki page on how to cache block output on Magentocommerce.com and read an inchoo article on how to do it. However, I want to cache the output of a module that isn't tied into a product.
What my module does is load up the colour entries in an attribute, does some maths on them to sort them by tint/hue/brightness etc. and then outputs a colour picker (that can be used on product pages).
I have other modules that could also benefit from cache control, again these are not particularly tied to a product. Hence, in the tutorials, where there is this:
'cache_tags' => array(Mage_Catalog_Model_Product::CACHE_TAG),
'cache_key' => $this->getProduct()->getId()
do I just stuff in any old numbers?
http://inchoo.net/ecommerce/magento/magento-block-caching/
http://www.magentocommerce.com/wiki/5_-_modules_and_development/block_cache_and_html_ouput
Upvotes: 1
Views: 1255
Reputation: 5277
You should use custom cache tag and key
'cache_tags' => array(Yourpackage_Yourmodule_Model_Yourmodel::CACHE_TAG)
'cache_key' => '<your cache key here>'
If I got you right, your block output is always the same, that's why you can use attribute code as cache tag and attribute id as key (for example).
Upvotes: 2