Example #1
0
 /**
  * Prepare grid collection
  */
 protected function _prepareCollection()
 {
     $collection = new Varien_Data_Collection();
     $cache = Mage::helper('varnish')->getRedisCache()->getFrontend();
     $ids = $cache->getIdsMatchingTags(array('VARNISH-CACHETYPE-PER-PAGE'));
     foreach ($ids as $id) {
         $data = unserialize($cache->load($id));
         $item = new Varien_Object();
         $item->setId($id);
         $item->setStoreId($data->getStoreId());
         $item->setParentUrl($data->getParentUrl());
         $item->setBlockName($data->getNameInLayout());
         $item->setFingerprint($id);
         $item->setProbeUrl($data->getUrl());
         $collection->addItem($item);
     }
     $this->setCollection($collection);
     $sort = $this->getParam($this->getVarNameSort()) ? $this->getParam($this->getVarNameSort()) : $this->getDefaultSort();
     $dir = $this->getParam($this->getVarNameDir()) ? $this->getParam($this->getVarNameDir()) : $this->getDefaultDir();
     $this->_sortCollectionBy($sort, $dir);
     return parent::_prepareCollection();
 }