當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Cache\TypeListInterface類代碼示例

本文整理匯總了PHP中Magento\Framework\App\Cache\TypeListInterface的典型用法代碼示例。如果您正苦於以下問題:PHP TypeListInterface類的具體用法?PHP TypeListInterface怎麽用?PHP TypeListInterface使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了TypeListInterface類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: testAfterDelete

 public function testAfterDelete()
 {
     $this->configMock->expects($this->any())->method('getValue')->willReturnMap([[Theme::XML_PATH_INVALID_CACHES, ScopeInterface::SCOPE_STORE, null, ['block_html' => 1, 'layout' => 1, 'translate' => 1]], [null, ScopeConfigInterface::SCOPE_TYPE_DEFAULT, null, 'old_value']]);
     $this->cacheTypeListMock->expects($this->exactly(2))->method('invalidate');
     $this->model->setValue('some_value');
     $this->assertSame($this->model, $this->model->afterDelete());
 }
開發者ID:rafaelstz,項目名稱:magento2,代碼行數:7,代碼來源:ThemeTest.php

示例2: execute

 /**
  * Invalidate full page cache
  *
  * @return void
  */
 public function execute()
 {
     if ($this->_config->isEnabled()) {
         $this->_typeList->invalidate('full_page');
     }
     return $this;
 }
開發者ID:zhangjiachao,項目名稱:magento2,代碼行數:12,代碼來源:InvalidateCache.php

示例3: testAfterSave

 /**
  * @param int $callNumber
  * @param string $oldValue
  * @dataProvider afterSaveDataProvider
  */
 public function testAfterSave($callNumber, $oldValue)
 {
     $this->cacheTypeListMock->expects($this->exactly($callNumber))->method('invalidate');
     $this->configMock->expects($this->any())->method('getValue')->willReturnMap([[Theme::XML_PATH_INVALID_CACHES, \Magento\Store\Model\ScopeInterface::SCOPE_STORE, null, ['block_html' => 1, 'layout' => 1, 'translate' => 1]], [null, \Magento\Framework\App\Config\ScopeConfigInterface::SCOPE_TYPE_DEFAULT, null, $oldValue]]);
     $this->model->setValue('some_value');
     $this->assertInstanceOf(get_class($this->model), $this->model->afterSave());
 }
開發者ID:pradeep-wagento,項目名稱:magento2,代碼行數:12,代碼來源:ThemeTest.php

示例4: execute

 /**
  * 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);
 }
開發者ID:magefan,項目名稱:module-blog,代碼行數:14,代碼來源:InvalidateCache.php

示例5: execute

 /**
  * Toggle cache
  *
  */
 public function execute()
 {
     $allTypes = array_keys($this->_cacheTypeList->getTypes());
     $updatedTypes = 0;
     $disable = true;
     $enable = true;
     foreach ($allTypes as $code) {
         if ($this->_cacheState->isEnabled($code) && $disable) {
             $this->_cacheState->setEnabled($code, false);
             $updatedTypes++;
             $enable = false;
         }
         if (!$this->_cacheState->isEnabled($code) && $enable) {
             $this->_cacheState->setEnabled($code, true);
             $updatedTypes++;
             $disable = false;
         }
         if ($disable) {
             $this->_cacheTypeList->cleanType($code);
         }
     }
     if ($updatedTypes > 0) {
         $this->_cacheState->persist();
         $this->messageManager->addSuccess(__("%1 cache type(s) disabled.", $updatedTypes));
     }
 }
開發者ID:dineshmalekar,項目名稱:Magento2-Developer-Debug-Tool,代碼行數:30,代碼來源:Togglecache.php

示例6: afterExecute

 /**
  * @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;
 }
開發者ID:kidaa30,項目名稱:magento2-platformsh,代碼行數:14,代碼來源:Execute.php

示例7: afterAfterSave

 /**
  * 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;
 }
開發者ID:pradeep-wagento,項目名稱:magento2,代碼行數:15,代碼來源:CacheInvalidator.php

示例8: _getCacheTypesForRefresh

 /**
  * Get array of cache types which require data refresh
  *
  * @return array
  */
 protected function _getCacheTypesForRefresh()
 {
     $output = array();
     foreach ($this->_cacheTypeList->getInvalidated() as $type) {
         $output[] = $type->getCacheType();
     }
     return $output;
 }
開發者ID:Atlis,項目名稱:docker-magento2,代碼行數:13,代碼來源:CacheOutdated.php

示例9: testAfterExecuteInvalidate

 public function testAfterExecuteInvalidate()
 {
     $subject = $this->getMockBuilder('Magento\\Catalog\\Model\\Indexer\\Category\\Product\\AbstractAction')->disableOriginalConstructor()->getMockForAbstractClass();
     $result = $this->getMockBuilder('Magento\\Catalog\\Model\\Indexer\\Category\\Product\\AbstractAction')->disableOriginalConstructor()->getMockForAbstractClass();
     $this->config->expects($this->once())->method('isEnabled')->willReturn(true);
     $this->typeList->expects($this->once())->method('invalidate')->with('full_page');
     $this->assertEquals($result, $this->execute->afterExecute($subject, $result));
 }
開發者ID:pradeep-wagento,項目名稱:magento2,代碼行數:8,代碼來源:ExecuteTest.php

示例10: afterSave

 /**
  * @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;
 }
開發者ID:Doability,項目名稱:magento2dev,代碼行數:13,代碼來源:CacheInvalidate.php

示例11: aroundSave

 /**
  * @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;
 }
開發者ID:shabbirvividads,項目名稱:magento2,代碼行數:16,代碼來源:Save.php

示例12: testExecute

 /**
  * @dataProvider invalidateCacheDataProvider
  * @param bool $cacheState
  */
 public function testExecute($cacheState)
 {
     $this->_configMock->expects($this->once())->method('isEnabled')->will($this->returnValue($cacheState));
     if ($cacheState) {
         $this->_typeListMock->expects($this->once())->method('invalidate')->with($this->equalTo('full_page'));
     }
     $this->_model->execute($this->observerMock);
 }
開發者ID:Doability,項目名稱:magento2dev,代碼行數:12,代碼來源:InvalidateCacheTest.php

示例13: afterSave

 /**
  * 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;
 }
開發者ID:whoople,項目名稱:magento2-testing,代碼行數:13,代碼來源:Translate.php

示例14: testExecuteNoChanged

 /**
  * @dataProvider invalidateCacheDataProvider
  * @param bool $cacheState
  */
 public function testExecuteNoChanged($cacheState)
 {
     $this->configMock->expects($this->once())->method('isEnabled')->will($this->returnValue($cacheState));
     $this->typeListMock->expects($this->never())->method('invalidate');
     if ($cacheState) {
         $this->objectMock->expects($this->once())->method('getIdentities')->will($this->returnValue([]));
     }
     $this->model->execute($this->observerMock);
 }
開發者ID:pradeep-wagento,項目名稱:magento2,代碼行數:13,代碼來源:InvalidateCacheIfChangedTest.php

示例15: loadData

 /**
  * Load data
  *
  * @param bool $printQuery
  * @param bool $logQuery
  * @return $this
  * @SuppressWarnings(PHPMD.UnusedFormalParameter)
  */
 public function loadData($printQuery = false, $logQuery = false)
 {
     if (!$this->isLoaded()) {
         foreach ($this->_cacheTypeList->getTypes() as $type) {
             $this->addItem($type);
         }
         $this->_setIsLoaded(true);
     }
     return $this;
 }
開發者ID:shabbirvividads,項目名稱:magento2,代碼行數:18,代碼來源:Collection.php


注:本文中的Magento\Framework\App\Cache\TypeListInterface類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。