0

My collection model is testimonial/record. In database table(testimonial_record) 2,00,000 records so it loads more how to decrease time to fetch collection data in grid.So I think I have to store collection in cache to display in grid.is this good approach ? if good approach how to store collection in cache.

How can use below cache function in collection grid ?

Mage::app()->saveCache($data, $this->_cacheId, array(self::CACHE_TAG), 604800);

my Grid.php

protected function _prepareCollection()
        {       $collection = Mage::getModel("testimonial/record")->getCollection();
                $this->setCollection($collection);
                return parent::_prepareCollection();
        }
0

You can cache one particular block in magento . so, call your collection in block and cache your block.

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

For more refrence follow below URL

http://inchoo.net/magento/magento-block-caching/

  • I am not display thi collection data in frontend as block .this is for only backend data.I want to use in only backend so how can I ? – Niraj Patel Jul 21 '16 at 6:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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