@@ -69,6 +69,7 @@ class Kernel
69
69
* @param \Magento\Framework\App\Response\HttpFactory|null $httpFactory
70
70
* @param \Magento\Framework\Serialize\SerializerInterface|null $serializer
71
71
* @param AppState|null $state
72
+ * @param \Magento\PageCache\Model\Cache\Type $fullPageCache
72
73
*/
73
74
public function __construct (
74
75
\Magento \Framework \App \PageCache \Cache $ cache ,
@@ -78,7 +79,8 @@ public function __construct(
78
79
\Magento \Framework \App \Http \ContextFactory $ contextFactory = null ,
79
80
\Magento \Framework \App \Response \HttpFactory $ httpFactory = null ,
80
81
\Magento \Framework \Serialize \SerializerInterface $ serializer = null ,
81
- AppState $ state = null
82
+ AppState $ state = null ,
83
+ \Magento \PageCache \Model \Cache \Type $ fullPageCache = null
82
84
) {
83
85
$ this ->cache = $ cache ;
84
86
$ this ->identifier = $ identifier ;
@@ -94,6 +96,9 @@ public function __construct(
94
96
\Magento \Framework \Serialize \SerializerInterface::class
95
97
);
96
98
$ this ->state = $ state ?? ObjectManager::getInstance ()->get (AppState::class);
99
+ $ this ->fullPageCache = $ fullPageCache ?? ObjectManager::getInstance ()->get (
100
+ \Magento \PageCache \Model \Cache \Type::class
101
+ );
97
102
}
98
103
99
104
/**
@@ -104,7 +109,7 @@ public function __construct(
104
109
public function load ()
105
110
{
106
111
if ($ this ->request ->isGet () || $ this ->request ->isHead ()) {
107
- $ responseData = $ this ->getCache () ->load ($ this ->identifier ->getValue ());
112
+ $ responseData = $ this ->fullPageCache ->load ($ this ->identifier ->getValue ());
108
113
if (!$ responseData ) {
109
114
return false ;
110
115
}
@@ -143,7 +148,7 @@ public function process(\Magento\Framework\App\Response\Http $response)
143
148
header_remove ('Set-Cookie ' );
144
149
}
145
150
146
- $ this ->getCache () ->save (
151
+ $ this ->fullPageCache ->save (
147
152
$ this ->serializer ->serialize ($ this ->getPreparedData ($ response )),
148
153
$ this ->identifier ->getValue (),
149
154
$ tags ,
@@ -197,19 +202,4 @@ private function buildResponse($responseData)
197
202
198
203
return $ response ;
199
204
}
200
-
201
- /**
202
- * TODO: Workaround to support backwards compatibility, will rework to use Dependency Injection in MAGETWO-49547
203
- *
204
- * @return \Magento\PageCache\Model\Cache\Type
205
- */
206
- private function getCache ()
207
- {
208
- if (!$ this ->fullPageCache ) {
209
- $ this ->fullPageCache = ObjectManager::getInstance ()->get (
210
- \Magento \PageCache \Model \Cache \Type::class
211
- );
212
- }
213
- return $ this ->fullPageCache ;
214
- }
215
205
}
0 commit comments