コード例 #1
0
 /**
  * Invalidate full page and block cache
  *
  * @param \Magento\Framework\Event\Observer $observer
  * @return void
  * @SuppressWarnings(PHPMD.UnusedFormalParameter)
  */
 public function execute(\Magento\Framework\Event\Observer $observer)
 {
     if ($this->_config->isEnabled()) {
         $this->_typeList->invalidate(\Magento\PageCache\Model\Cache\Type::TYPE_IDENTIFIER);
     }
     $this->_typeList->invalidate(\Magento\Framework\App\Cache\Type\Block::TYPE_IDENTIFIER);
 }
コード例 #2
0
 /**
  * Invalidate full page cache
  *
  * @return void
  */
 public function execute()
 {
     if ($this->_config->isEnabled()) {
         $this->_typeList->invalidate('full_page');
     }
     return $this;
 }
コード例 #3
0
 /**
  * @param AbstractAction $subject
  * @param AbstractAction $result
  * @return AbstractAction
  *
  * @SuppressWarnings(PHPMD.UnusedFormalParameter)
  */
 public function afterExecute(AbstractAction $subject, AbstractAction $result)
 {
     if ($this->config->isEnabled()) {
         $this->typeList->invalidate('full_page');
     }
     return $result;
 }
コード例 #4
0
 /**
  * Invalidate WebApi cache if needed.
  * 
  * @param \Magento\Framework\App\Config\Value $subject
  * @param \Magento\Framework\App\Config\Value $result
  * @return \Magento\Framework\App\Config\Value
  * @SuppressWarnings(PHPMD.UnusedFormalParameter)
  */
 public function afterAfterSave(\Magento\Framework\App\Config\Value $subject, \Magento\Framework\App\Config\Value $result)
 {
     if ($subject->getPath() == \Magento\WebapiSecurity\Model\Plugin\AnonymousResourceSecurity::XML_ALLOW_INSECURE && $subject->isValueChanged()) {
         $this->cacheTypeList->invalidate(\Magento\Framework\App\Cache\Type\Webapi::TYPE_IDENTIFIER);
     }
     return $result;
 }
コード例 #5
0
ファイル: Save.php プロジェクト: shabbirvividads/magento2
 /**
  * @param \Magento\Catalog\Model\Resource\Attribute $subject
  * @param callable $proceed
  * @param \Magento\Framework\Model\AbstractModel $attribute
  * @return mixed
  *
  * @SuppressWarnings(PHPMD.UnusedFormalParameter)
  */
 public function aroundSave(\Magento\Catalog\Model\Resource\Attribute $subject, \Closure $proceed, \Magento\Framework\Model\AbstractModel $attribute)
 {
     $result = $proceed($attribute);
     if ($this->config->isEnabled()) {
         $this->typeList->invalidate('full_page');
     }
     return $result;
 }
コード例 #6
0
 /**
  * Set status 'invalidate' for blocks and other output caches
  *
  * @return $this
  */
 public function afterSave()
 {
     $types = array_keys($this->_scopeConfig->getValue(self::XML_PATH_INVALID_CACHES, \Magento\Store\Model\ScopeInterface::SCOPE_STORE));
     if ($this->isValueChanged()) {
         $this->_cacheTypeList->invalidate($types);
     }
     return $this;
 }
コード例 #7
0
 /**
  * @param \Magento\Catalog\Model\ResourceModel\Eav\Attribute $subject
  * @param \Magento\Catalog\Model\ResourceModel\Eav\Attribute $result
  * @return \Magento\Catalog\Model\ResourceModel\Eav\Attribute
  */
 public function afterSave(\Magento\Catalog\Model\ResourceModel\Eav\Attribute $subject, \Magento\Catalog\Model\ResourceModel\Eav\Attribute $result)
 {
     if ($this->swatchHelper->isSwatchAttribute($subject)) {
         $this->typeList->invalidate(Block::TYPE_IDENTIFIER);
         $this->typeList->invalidate(Collection::TYPE_IDENTIFIER);
     }
     return $result;
 }
コード例 #8
0
 /**
  * Invalidate full page cache if content is changed
  *
  * @param \Magento\Framework\Event\Observer $observer
  * @return void
  */
 public function execute(\Magento\Framework\Event\Observer $observer)
 {
     if ($this->config->isEnabled()) {
         $object = $observer->getEvent()->getObject();
         if ($object instanceof \Magento\Framework\Object\IdentityInterface) {
             if ($object->getIdentities()) {
                 $this->typeList->invalidate('full_page');
             }
         }
     }
 }
コード例 #9
0
ファイル: Instance.php プロジェクト: whoople/magento2-testing
 /**
  * Invalidate related cache types
  *
  * @return $this
  */
 protected function _invalidateCache()
 {
     if (count($this->_relatedCacheTypes)) {
         $this->_cacheTypeList->invalidate($this->_relatedCacheTypes);
     }
     return $this;
 }
コード例 #10
0
ファイル: Value.php プロジェクト: pradeep-wagento/magento2
 /**
  * {@inheritdoc}
  *
  * {@inheritdoc}. In addition, it sets status 'invalidate' for config caches
  *
  * @return $this
  */
 public function afterSave()
 {
     if ($this->isValueChanged()) {
         $this->cacheTypeList->invalidate(\Magento\Framework\App\Cache\Type\Config::TYPE_IDENTIFIER);
     }
     return parent::afterSave();
 }
コード例 #11
0
 /**
  * Parse and save edited translation
  *
  * @param array $translateParams
  * @return array
  */
 public function processAjaxPost(array $translateParams)
 {
     if (!$this->_translateInline->isAllowed()) {
         return ['inline' => 'not allowed'];
     }
     $this->_appCache->invalidate(\Magento\Framework\App\Cache\Type\Translate::TYPE_IDENTIFIER);
     $this->_validateTranslationParams($translateParams);
     $this->_filterTranslationParams($translateParams, ['custom']);
     /** @var $validStoreId int */
     $validStoreId = $this->_storeManager->getStore()->getId();
     /** @var $resource \Magento\Translation\Model\ResourceModel\StringUtils */
     $resource = $this->_resourceFactory->create();
     foreach ($translateParams as $param) {
         if ($this->_appState->getAreaCode() == \Magento\Backend\App\Area\FrontNameResolver::AREA_CODE) {
             $storeId = 0;
         } else {
             if (empty($param['perstore'])) {
                 $resource->deleteTranslate($param['original'], null, false);
                 $storeId = 0;
             } else {
                 $storeId = $validStoreId;
             }
         }
         $resource->saveTranslate($param['original'], $param['custom'], null, $storeId);
     }
     return $this->getCacheManger()->updateAndGetTranslations();
 }
コード例 #12
0
 /**
  * Clear translate cache
  *
  * @return $this
  */
 protected function clearCache()
 {
     // clear cache for frontend
     foreach ($this->_cacheTypes as $cacheType) {
         $this->_cacheTypeList->invalidate($cacheType);
     }
     return $this;
 }
コード例 #13
0
ファイル: Data.php プロジェクト: nja78/magento2
 /**
  * Invalidate Cache
  *
  * @return $this
  */
 public function invalidateCache()
 {
     if ($cacheTypes = $this->_cacheConfig->getTypes()) {
         $cacheTypesList = array_keys($cacheTypes);
         $this->_cacheTypeList->invalidate($cacheTypesList);
     }
     return $this;
 }
コード例 #14
0
 /**
  * Invalidate full page cache
  *
  * @param \Magento\Framework\Event\Observer $observer
  * @return void
  * @SuppressWarnings(PHPMD.UnusedFormalParameter)
  */
 public function execute(\Magento\Framework\Event\Observer $observer)
 {
     if ($this->_config->isEnabled()) {
         $this->_typeList->invalidate('full_page');
     }
 }
コード例 #15
0
ファイル: Links.php プロジェクト: whoople/magento2-testing
 /**
  * Invalidate cache type, when value was changed
  *
  * @return void
  */
 public function afterSave()
 {
     if ($this->isValueChanged()) {
         $this->_cacheTypeList->invalidate(\Magento\Framework\View\Element\AbstractBlock::CACHE_GROUP);
     }
 }
コード例 #16
0
 /**
  * {@inheritdoc}
  *
  * {@inheritdoc}. In addition, it sets status 'invalidate' for config caches
  *
  * @return $this
  */
 public function afterDelete()
 {
     $this->cacheTypeList->invalidate(\Magento\Framework\App\Cache\Type\Config::TYPE_IDENTIFIER);
     return parent::afterDelete();
 }