comparison core/modules/page_cache/src/StackMiddleware/PageCache.php @ 18:af1871eacc83

Update to Drupal core 8.7.1
author Chris Cannam
date Thu, 09 May 2019 15:33:08 +0100
parents 129ea1e6d783
children
comparison
equal deleted inserted replaced
17:129ea1e6d783 18:af1871eacc83
44 * A policy rule determining the cacheability of the response. 44 * A policy rule determining the cacheability of the response.
45 * 45 *
46 * @var \Drupal\Core\PageCache\ResponsePolicyInterface 46 * @var \Drupal\Core\PageCache\ResponsePolicyInterface
47 */ 47 */
48 protected $responsePolicy; 48 protected $responsePolicy;
49
50 /**
51 * The cache ID for the (master) request.
52 *
53 * @var string
54 */
55 protected $cid;
49 56
50 /** 57 /**
51 * Constructs a PageCache object. 58 * Constructs a PageCache object.
52 * 59 *
53 * @param \Symfony\Component\HttpKernel\HttpKernelInterface $http_kernel 60 * @param \Symfony\Component\HttpKernel\HttpKernelInterface $http_kernel
337 * 344 *
338 * @return string 345 * @return string
339 * The cache ID for this request. 346 * The cache ID for this request.
340 */ 347 */
341 protected function getCacheId(Request $request) { 348 protected function getCacheId(Request $request) {
342 $cid_parts = [ 349 // Once a cache ID is determined for the request, reuse it for the duration
343 $request->getSchemeAndHttpHost() . $request->getRequestUri(), 350 // of the request. This ensures that when the cache is written, it is only
344 $request->getRequestFormat(), 351 // keyed on request data that was available when it was read. For example,
345 ]; 352 // the request format might be NULL during cache lookup and then set during
346 return implode(':', $cid_parts); 353 // routing, in which case we want to key on NULL during writing, since that
354 // will be the value during lookups for subsequent requests.
355 if (!isset($this->cid)) {
356 $cid_parts = [
357 $request->getSchemeAndHttpHost() . $request->getRequestUri(),
358 $request->getRequestFormat(NULL),
359 ];
360 $this->cid = implode(':', $cid_parts);
361 }
362 return $this->cid;
347 } 363 }
348 364
349 } 365 }