markdown 全页缓存的东西

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了markdown 全页缓存的东西相关的知识,希望对你有一定的参考价值。

# Magento 2 Full Page Cache

Magento trigger fullpagecache before everything is dispath, by using plugin on FrontController

### vendor/magento/module-page-cache/etc/di.xml
```xml
<type name="Magento\Framework\App\FrontControllerInterface">
  <plugin name="front-controller-builtin-cache" type="Magento\PageCache\Model\App\FrontController\BuiltinPlugin"/>
  <plugin name="front-controller-varnish-cache" type="Magento\PageCache\Model\App\FrontController\VarnishPlugin"/>
</type>
```
It checked if there is a cache available for this current page 
### Magento\PageCache\Model\App\FrontController\BuiltinPlugin
```php
public function aroundDispatch(
    \Magento\Framework\App\FrontControllerInterface $subject,
    \Closure $proceed,
    \Magento\Framework\App\RequestInterface $request
) {
    $this->version->process();
    if (!$this->config->isEnabled() || $this->config->getType() != \Magento\PageCache\Model\Config::BUILT_IN) {
        return $proceed($request);
    }
    $result = $this->kernel->load();
    if ($result === false) {
        $result = $proceed($request);
        if ($result instanceof ResponseHttp) {
            $this->addDebugHeaders($result);
            $this->kernel->process($result);
        }
    } else {
        $this->addDebugHeader($result, 'X-Magento-Cache-Debug', 'HIT', true);
    }
    return $result;
}
```

The cache of current page is identified by bellow code
### Magento\Framework\App\PageCache\Identifier
```php
/**
 * Return unique page identifier
 *
 * @return string
 */
public function getValue()
{
    $data = [
        $this->request->isSecure(),
        $this->request->getUriString(),
        $this->request->get(\Magento\Framework\App\Response\Http::COOKIE_VARY_STRING)
            ?: $this->context->getVaryString()
    ];
    return md5(serialize($data));
}
```

以上是关于markdown 全页缓存的东西的主要内容,如果未能解决你的问题,请参考以下文章

php缓存技术总结

基于spring框架的redis缓存

如何为购物车块实现magento缓存打孔

typescript 全页模式 - Toogle选择的相册

完美的全页背景图片

Redis 16 大应用场景,竟然这么多。。