/** * Get cahce tags associated with object id * * @return array */ public function getCacheIdTags() { $tags = parent::getCacheIdTags(); if ($tags && $this->getPageId()) { $tags[] = Mage_Cms_Model_Page::CACHE_TAG . '_' . $this->getPageId(); } return $tags; }
/** * Get cahce tags associated with object id. * Added category id tags support * * @return array */ public function getCacheIdTags() { $tags = parent::getCacheIdTags(); if ($this->getCategoryId()) { $tags[] = Mage_Catalog_Model_Category::CACHE_TAG . '_' . $this->getCategoryId(); } return $tags; }
/** * Clean cache by specified entity and its ids * * @param Mage_Core_Model_Abstract $entity * @param array $ids */ protected function _cleanEntityCache(Mage_Core_Model_Abstract $entity, array $ids) { $cacheTags = array(); foreach ($ids as $entityId) { $entity->setId($entityId); $cacheTags = array_unique(array_merge($cacheTags, $entity->getCacheIdTags())); } if (!empty($cacheTags)) { Enterprise_PageCache_Model_Cache::getCacheInstance()->clean($cacheTags); } }
/** * Add tags from specified model to current block * * @param Mage_Core_Model_Abstract $model * @return Mage_Core_Block_Abstract */ public function addModelTags(Mage_Core_Model_Abstract $model) { $cacheTags = $model->getCacheIdTags(); if (false !== $cacheTags) { $this->addCacheTag($cacheTags); } return $this; }
/** * Clean cache by entity tags * * @param Mage_Core_Model_Abstract $object * @return Enterprise_PageCache_Model_Validator */ public function cleanEntityCache(Mage_Core_Model_Abstract $object) { $tags = $object->getCacheIdTags(); if (!empty($tags)) { $this->_getCacheInstance()->clean($tags); } return $this; }
/** * Add cache tags from the given model * * @param Mage_Core_Model_Abstract $model source model * * @return void */ public function addModelCacheTags(Mage_Core_Model_Abstract $model) { // Strange check, but it seems that it's the only way to see if $_cacheTag is set (and not just equal to "true") if ($model->getCacheTags() !== false && $model->getCacheTags() !== array()) { $tags = $model->getCacheIdTags(); Mage::helper('smile_magecache')->addTags($tags); } }
/** * Get cache tags associated with object id * * @return array */ public function getCacheIdTags() { $tags = parent::getCacheIdTags(); $tags[] = 'TM_TESTIMONIAL_' . $this->getTestimonialId(); return $tags; }