handleCompression($data); $tags[] = \Magento\PageCache\Model\Cache\Type::CACHE_TAG; return [$data, $identifier, $tags, $lifeTime]; } /** * Enable cache de-compression * * @param \Magento\Framework\App\PageCache\Cache $subject * @param string $result * @return string|bool * @throws \Magento\Framework\Exception\LocalizedException * * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ public function afterLoad( \Magento\Framework\App\PageCache\Cache $subject, $result ) { if ($result && strpos($result, self::COMPRESSION_PREFIX) === 0) { $result = function_exists('gzuncompress') ? gzuncompress(substr($result, strlen(self::COMPRESSION_PREFIX))) : false; } return $result; } /** * Label compressed entries and check if gzcompress exists * * @param string $data * @return string */ private function handleCompression($data) { if (function_exists('gzcompress')) { $data = self::COMPRESSION_PREFIX . gzcompress($data); } return $data; } }