Commit 687d4cff authored by catch's avatar catch

Issue #2889603 by Wim Leers, fgm: Split the internal page cache from the rest of the render cache

parent 5db87356
......@@ -379,7 +379,7 @@ public function testBlockCacheTags() {
$this->assertEqual($this->drupalGetHeader('X-Drupal-Cache'), 'HIT');
$cid_parts = [\Drupal::url('<front>', [], ['absolute' => TRUE]), 'html'];
$cid = implode(':', $cid_parts);
$cache_entry = \Drupal::cache('render')->get($cid);
$cache_entry = \Drupal::cache('page')->get($cid);
$expected_cache_tags = [
'config:block_list',
'block_view',
......@@ -420,7 +420,7 @@ public function testBlockCacheTags() {
$this->assertEqual($this->drupalGetHeader('X-Drupal-Cache'), 'HIT');
$cid_parts = [\Drupal::url('<front>', [], ['absolute' => TRUE]), 'html'];
$cid = implode(':', $cid_parts);
$cache_entry = \Drupal::cache('render')->get($cid);
$cache_entry = \Drupal::cache('page')->get($cid);
$expected_cache_tags = [
'config:block_list',
'block_view',
......
services:
http_middleware.page_cache:
class: Drupal\page_cache\StackMiddleware\PageCache
arguments: ['@cache.render', '@page_cache_request_policy', '@page_cache_response_policy']
arguments: ['@cache.page', '@page_cache_request_policy', '@page_cache_response_policy']
tags:
- { name: http_middleware, priority: 200, responder: true }
cache.page:
class: Drupal\Core\Cache\CacheBackendInterface
tags:
- { name: cache.bin }
factory: cache_factory:get
arguments: [page]
......@@ -59,7 +59,7 @@ public function testPageCacheTags() {
$this->assertEqual($this->drupalGetHeader('X-Drupal-Cache'), 'HIT');
$cid_parts = [\Drupal::url('system_test.cache_tags_page', [], ['absolute' => TRUE]), 'html'];
$cid = implode(':', $cid_parts);
$cache_entry = \Drupal::cache('render')->get($cid);
$cache_entry = \Drupal::cache('page')->get($cid);
sort($cache_entry->tags);
$expected_tags = [
'config:user.role.anonymous',
......@@ -91,7 +91,7 @@ public function testPageCacheTagsIndependentFromCacheabilityHeaders() {
$this->assertEqual($this->drupalGetHeader('X-Drupal-Cache'), 'HIT');
$cid_parts = [\Drupal::url('system_test.cache_tags_page', [], ['absolute' => TRUE]), 'html'];
$cid = implode(':', $cid_parts);
$cache_entry = \Drupal::cache('render')->get($cid);
$cache_entry = \Drupal::cache('page')->get($cid);
sort($cache_entry->tags);
$expected_tags = [
'config:user.role.anonymous',
......@@ -156,7 +156,7 @@ public function testQueryParameterFormatRequests() {
// Clear the page cache. After that request a HAL request, followed by an
// ordinary HTML one.
\Drupal::cache('render')->deleteAll();
\Drupal::cache('page')->deleteAll();
$this->drupalGet($node_url_with_hal_json_format);
$this->assertEqual($this->drupalGetHeader('X-Drupal-Cache'), 'MISS');
$this->assertEqual($this->drupalGetHeader('Content-Type'), 'application/hal+json');
......@@ -374,7 +374,7 @@ public function testPageCacheAnonymous403404() {
$this->assertEqual($this->drupalGetHeader('X-Drupal-Cache'), 'MISS');
// Ensure the 'expire' field on the cache entry uses cache_ttl_4xx.
$cache_item = \Drupal::service('cache.render')->get($this->getUrl() . ':html');
$cache_item = \Drupal::service('cache.page')->get($this->getUrl() . ':html');
$difference = $cache_item->expire - (int) $cache_item->created;
// Given that a second might have passed we cannot be sure that
// $difference will exactly equal the default cache_ttl_4xx setting.
......@@ -393,7 +393,7 @@ public function testPageCacheAnonymous403404() {
'required' => TRUE,
];
$this->writeSettings($settings);
\Drupal::service('cache.render')->deleteAll();
\Drupal::service('cache.page')->deleteAll();
foreach ($tests as $code => $content_url) {
// Getting the 404 page twice should still result in a cache miss.
......
......@@ -91,7 +91,7 @@ protected function assertPageCacheContextsAndTags(Url $url, array $expected_cont
// Assert page cache item + expected cache tags.
$cid_parts = [$url->setAbsolute()->toString(), 'html'];
$cid = implode(':', $cid_parts);
$cache_entry = \Drupal::cache('render')->get($cid);
$cache_entry = \Drupal::cache('page')->get($cid);
sort($cache_entry->tags);
$this->assertEqual($cache_entry->tags, $expected_tags);
$this->debugCacheTags($cache_entry->tags, $expected_tags);
......
......@@ -54,7 +54,7 @@ protected function verifyPageCache(Url $url, $hit_or_miss, $tags = FALSE) {
$absolute_url = $url->setAbsolute()->toString();
$cid_parts = [$absolute_url, 'html'];
$cid = implode(':', $cid_parts);
$cache_entry = \Drupal::cache('render')->get($cid);
$cache_entry = \Drupal::cache('page')->get($cid);
sort($cache_entry->tags);
$tags = array_unique($tags);
sort($tags);
......
......@@ -51,7 +51,7 @@ protected function verifyPageCache(Url $url, $hit_or_miss, $tags = FALSE) {
$absolute_url = $url->setAbsolute()->toString();
$cid_parts = [$absolute_url, 'html'];
$cid = implode(':', $cid_parts);
$cache_entry = \Drupal::cache('render')->get($cid);
$cache_entry = \Drupal::cache('page')->get($cid);
sort($cache_entry->tags);
$tags = array_unique($tags);
sort($tags);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment