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();
        }

1 Answer 1

0

You can cache one particular block in Magento. so, call your collection in the 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 reference follow below URL

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

1
  • 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 ? Commented Jul 21, 2016 at 6:36

Your Answer

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

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