Magento Extensions Rating 2024
EXTENSIONS BY CATEGORY
B2B (Business-To-Business)
Blog
Customer
ERP (Enterprise Resource Planning)
Mega Menu
One Step Checkout
Order
POS (Point Of Sale)
Search
Shopping Cart
Sitemap
SEO
Social
Stock & Inventory Management
EXTENSIONS BY DEVELOPER
aheadWorks
Amasty
Boost My Shop
BSS Commerce
Magestore
MageWorx
Mirasvit
Templates Master
Wyomind
XTENTO
Magento 2 Documentation
Magento 2 Documentation
2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
vendor
magento
module-page-cache
Model
App
PageCachePlugin.php
Go to the documentation of this file.
1
<?php
2
/***
3
* Copyright © Magento, Inc. All rights reserved.
4
* See COPYING.txt for license details.
5
*/
6
7
namespace
Magento\PageCache\Model\App
;
8
9
class
PageCachePlugin
10
{
14
const
COMPRESSION_PREFIX
=
'COMPRESSED_CACHE_'
;
15
28
public
function
beforeSave
(
29
\
Magento
\Framework\
App
\PageCache\Cache $subject,
30
$data
,
31
$identifier,
32
$tags = [],
33
$lifeTime =
null
34
) {
35
$data
= $this->handleCompression(
$data
);
36
$tags[] =
\Magento\PageCache\Model\Cache\Type::CACHE_TAG
;
37
return
[
$data
, $identifier, $tags, $lifeTime];
38
}
39
50
public
function
afterLoad
(
51
\
Magento
\Framework\
App
\PageCache\Cache $subject,
52
$result
53
) {
54
if
(
$result
&& strpos(
$result
, self::COMPRESSION_PREFIX) === 0) {
55
$result
=
function_exists
(
'gzuncompress'
)
56
? gzuncompress(substr(
$result
, strlen(self::COMPRESSION_PREFIX)))
57
:
false
;
58
}
59
return
$result
;
60
}
61
68
private
function
handleCompression(
$data
)
69
{
70
if
(
function_exists
(
'gzcompress'
)) {
71
$data
= self::COMPRESSION_PREFIX . gzcompress(
$data
);
72
}
73
return
$data
;
74
}
75
}
$result
$result
Definition:
product_configurable_not_available_rollback.php:26
Magento\Framework\App
Magento\PageCache\Model\App\PageCachePlugin\beforeSave
beforeSave(\Magento\Framework\App\PageCache\Cache $subject, $data, $identifier, $tags=[], $lifeTime=null)
Definition:
PageCachePlugin.php:28
Magento\PageCache\Model\Cache\Type\CACHE_TAG
const CACHE_TAG
Definition:
Type.php:23
$data
$data
Definition:
attribute_set_with_image_attribute.php:16
Magento
Magento\PageCache\Model\App\PageCachePlugin\COMPRESSION_PREFIX
const COMPRESSION_PREFIX
Definition:
PageCachePlugin.php:14
Magento\PageCache\Model\App
Definition:
CacheIdentifierPlugin.php:7
Magento\Deploy\Console\Command\function_exists
function_exists($func)
Definition:
FunctionExistMock.php:13
Magento\PageCache\Model\App\PageCachePlugin\afterLoad
afterLoad(\Magento\Framework\App\PageCache\Cache $subject, $result)
Definition:
PageCachePlugin.php:50
Magento\PageCache\Model\App\PageCachePlugin
Definition:
PageCachePlugin.php:9