/**
  * Modify and cache application response
  *
  * @param \Magento\Framework\App\Response\Http $response
  * @return void
  */
 public function process(\Magento\Framework\App\Response\Http $response)
 {
     if (preg_match('/public.*s-maxage=(\\d+)/', $response->getHeader('Cache-Control')->getFieldValue(), $matches)) {
         $maxAge = $matches[1];
         $response->setNoCacheHeaders();
         if (($response->getHttpResponseCode() == 200 || $response->getHttpResponseCode() == 404) && ($this->request->isGet() || $this->request->isHead())) {
             $tagsHeader = $response->getHeader('X-Magento-Tags');
             $tags = $tagsHeader ? explode(',', $tagsHeader->getFieldValue()) : [];
             $response->clearHeader('Set-Cookie');
             $response->clearHeader('X-Magento-Tags');
             if (!headers_sent()) {
                 header_remove('Set-Cookie');
             }
             $this->getCache()->save(serialize($response), $this->identifier->getValue(), $tags, $maxAge);
         }
     }
 }
 /**
  * {@inheritdoc}
  */
 public function getValue()
 {
     $pluginInfo = $this->pluginList->getNext($this->subjectType, 'getValue');
     if (!$pluginInfo) {
         return parent::getValue();
     } else {
         return $this->___callPlugins('getValue', func_get_args(), $pluginInfo);
     }
 }
 /**
  * @param $cookieExists
  *
  * @dataProvider trueFalseDataProvider
  */
 public function testVaryStringSource($cookieExists)
 {
     $this->requestMock->method('get')->willReturn($cookieExists ? 'vary-string-from-cookie' : null);
     $this->contextMock->expects($cookieExists ? $this->never() : $this->once())->method('getVaryString');
     $this->model->getValue();
 }