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


PHP Config::getType方法代碼示例

本文整理匯總了PHP中Magento\PageCache\Model\Config::getType方法的典型用法代碼示例。如果您正苦於以下問題:PHP Config::getType方法的具體用法?PHP Config::getType怎麽用?PHP Config::getType使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Magento\PageCache\Model\Config的用法示例。


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

示例1: isVarnishEnabled

 /**
  * Is varnish cache engine enabled
  *
  * @return bool
  */
 protected function isVarnishEnabled()
 {
     if ($this->isVarnishEnabled === null) {
         $this->isVarnishEnabled = $this->_config->getType() == \Magento\PageCache\Model\Config::VARNISH;
     }
     return $this->isVarnishEnabled;
 }
開發者ID:pradeep-wagento,項目名稱:magento2,代碼行數:12,代碼來源:ProcessLayoutRenderElement.php

示例2: execute

 /**
  * If Built-In caching is enabled it collects array of tags
  * of incoming object and asks to clean cache.
  *
  * @param \Magento\Framework\Event\Observer $observer
  * @return void
  */
 public function execute(\Magento\Framework\Event\Observer $observer)
 {
     if ($this->_config->getType() == \Magento\PageCache\Model\Config::BUILT_IN && $this->_config->isEnabled()) {
         $object = $observer->getEvent()->getObject();
         if ($object instanceof \Magento\Framework\DataObject\IdentityInterface) {
             $tags = $object->getIdentities();
             if (!empty($tags)) {
                 $this->getCache()->clean(\Zend_Cache::CLEANING_MODE_MATCHING_ANY_TAG, array_unique($tags));
             }
         }
     }
 }
開發者ID:Doability,項目名稱:magento2dev,代碼行數:19,代碼來源:FlushCacheByTags.php

示例3: execute

 /**
  * If Built-In caching is enabled it collects array of tags
  * of incoming object and asks to clean cache.
  *
  * @param \Magento\Framework\Event\Observer $observer
  * @return void
  */
 public function execute(\Magento\Framework\Event\Observer $observer)
 {
     if ($this->_config->getType() == \Magento\PageCache\Model\Config::BUILT_IN && $this->_config->isEnabled()) {
         $object = $observer->getEvent()->getObject();
         if ($object instanceof \Magento\Framework\Object\IdentityInterface) {
             $tags = $object->getIdentities();
             foreach ($tags as $tag) {
                 $tags[] = preg_replace("~_\\d+\$~", '', $tag);
             }
             $this->_cache->clean(array_unique($tags));
         }
     }
 }
開發者ID:shabbirvividads,項目名稱:magento2,代碼行數:20,代碼來源:FlushCacheByTags.php

示例4: afterGetOutput

 /**
  * Retrieve all identities from blocks for further cache invalidation
  *
  * @param \Magento\Framework\View\Layout $subject
  * @param mixed $result
  * @return mixed
  */
 public function afterGetOutput(\Magento\Framework\View\Layout $subject, $result)
 {
     if ($subject->isCacheable() && $this->config->isEnabled()) {
         $tags = [];
         foreach ($subject->getAllBlocks() as $block) {
             if ($block instanceof \Magento\Framework\DataObject\IdentityInterface) {
                 $isEsiBlock = $block->getTtl() > 0;
                 $isVarnish = $this->config->getType() == \Magento\PageCache\Model\Config::VARNISH;
                 if ($isVarnish && $isEsiBlock) {
                     continue;
                 }
                 $tags = array_merge($tags, $block->getIdentities());
             }
         }
         $tags = array_unique($tags);
         $this->response->setHeader('X-Magento-Tags', implode(',', $tags));
     }
     return $result;
 }
開發者ID:kidaa30,項目名稱:magento2-platformsh,代碼行數:26,代碼來源:LayoutPlugin.php

示例5: execute

 /**
  * Add comment cache containers to private blocks
  * Blocks are wrapped only if page is cacheable
  *
  * @param \Magento\Framework\Event\Observer $observer
  * @return void
  */
 public function execute(\Magento\Framework\Event\Observer $observer)
 {
     $event = $observer->getEvent();
     /** @var \Magento\Framework\View\Layout $layout */
     $layout = $event->getLayout();
     if ($layout->isCacheable() && $this->_config->isEnabled()) {
         $name = $event->getElementName();
         $block = $layout->getBlock($name);
         $transport = $event->getTransport();
         if ($block instanceof \Magento\Framework\View\Element\AbstractBlock) {
             $blockTtl = $block->getTtl();
             $varnishIsEnabledFlag = $this->_config->getType() == \Magento\PageCache\Model\Config::VARNISH;
             $output = $transport->getData('output');
             if ($varnishIsEnabledFlag && isset($blockTtl)) {
                 $output = $this->_wrapEsi($block, $layout);
             } elseif ($block->isScopePrivate()) {
                 $output = sprintf('<!-- BLOCK %1$s -->%2$s<!-- /BLOCK %1$s -->', $block->getNameInLayout(), $output);
             }
             $transport->setData('output', $output);
         }
     }
 }
開發者ID:shabbirvividads,項目名稱:magento2,代碼行數:29,代碼來源:ProcessLayoutRenderElement.php

示例6: flushAllCache

 /**
  * Flash Built-In cache
  *
  * @param \Magento\Framework\Event\Observer $observer
  * @return void
  * 
  * @SuppressWarnings(PHPMD.UnusedFormalParameter)
  */
 public function flushAllCache(\Magento\Framework\Event\Observer $observer)
 {
     if ($this->_config->getType() == \Magento\PageCache\Model\Config::BUILT_IN) {
         $this->_cache->clean();
     }
 }
開發者ID:aiesh,項目名稱:magento2,代碼行數:14,代碼來源:Observer.php

示例7: execute

 /**
  * Flash Built-In cache
  *
  * @return void
  */
 public function execute()
 {
     if ($this->_config->getType() == \Magento\PageCache\Model\Config::BUILT_IN) {
         $this->_cache->clean();
     }
 }
開發者ID:shabbirvividads,項目名稱:magento2,代碼行數:11,代碼來源:FlushAllCache.php


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