当前位置: 首页>>代码示例>>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;未经允许,请勿转载。