Пример #1
0
 /**
  * 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;
 }
Пример #2
0
 /**
  * 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;
 }
Пример #3
0
 /**
  * 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);
     }
 }
Пример #4
0
 /**
  * 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;
 }
Пример #6
0
 /**
  * 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);
     }
 }
Пример #7
0
 /**
  * Get cache tags associated with object id
  *
  * @return array
  */
 public function getCacheIdTags()
 {
     $tags = parent::getCacheIdTags();
     $tags[] = 'TM_TESTIMONIAL_' . $this->getTestimonialId();
     return $tags;
 }