core/modules/dynamic_page_cache/dynamic_page_cache.info.yml | 2 +- core/modules/dynamic_page_cache/dynamic_page_cache.module | 4 ++-- .../src/EventSubscriber/DynamicPageCacheSubscriber.php | 10 ++++++++-- .../src/PageCache/ResponsePolicy/DenyAdminRoutes.php | 5 ++--- .../src/Tests/DynamicPageCacheIntegrationTest.php | 2 +- core/modules/page_cache/page_cache.info.yml | 2 +- 6 files changed, 15 insertions(+), 10 deletions(-) diff --git a/core/modules/dynamic_page_cache/dynamic_page_cache.info.yml b/core/modules/dynamic_page_cache/dynamic_page_cache.info.yml index b269036..00db97d 100644 --- a/core/modules/dynamic_page_cache/dynamic_page_cache.info.yml +++ b/core/modules/dynamic_page_cache/dynamic_page_cache.info.yml @@ -1,6 +1,6 @@ name: Internal Dynamic Page Cache type: module -description: 'Caches pages, minus the personalized parts. Works well for websites of all sizes.' +description: 'Caches pages for any user, handling dynamic content correctly.' package: Core version: VERSION core: 8.x diff --git a/core/modules/dynamic_page_cache/dynamic_page_cache.module b/core/modules/dynamic_page_cache/dynamic_page_cache.module index dcd224f..64d78f9 100644 --- a/core/modules/dynamic_page_cache/dynamic_page_cache.module +++ b/core/modules/dynamic_page_cache/dynamic_page_cache.module @@ -14,11 +14,11 @@ function dynamic_page_cache_help($route_name, RouteMatchInterface $route_match) switch ($route_name) { case 'help.page.dynamic_page_cache': $output = '

' . t('About') . '

'; - $output .= '

' . t('The Dynamic Page Cache module caches pages for authenticated users in the database, minus the personalized parts. For more information, see the online documentation for the Dynamic Page Cache module.', ['!dynamic_page_cache-documentation' => 'https://www.drupal.org/documentation/modules/dynamic_page_cache']) . '

'; + $output .= '

' . t('The Dynamic Page Cache module caches pages for all users in the database, handling dynamic content correctly. For more information, see the online documentation for the Dynamic Page Cache module.', ['!dynamic_page_cache-documentation' => 'https://www.drupal.org/documentation/modules/dynamic_page_cache']) . '

'; $output .= '

' . t('Uses') . '

'; $output .= '
'; $output .= '
' . t('Speeding up your site') . '
'; - $output .= '
' . t('Pages are stored the first time they are requested if they are safe to cache, and then are reused. Personalized parts are excluded automatically. Depending on your site configuration and the complexity of particular pages, Dynamic Page Cache may significantly increase the speed of your site, even for authenticated users.') . '
'; + $output .= '
' . t('Pages are cached the first time they are requested if they are suitable from caching, then the cached version is served for all later requests. Dynamic content is handled automatically so that both cache correctness and hit ratio is maintained.') . '
'; $output .= '
' . t('The module requires no configuration. Every part of the page contains metadata that allows Dynamic Page Cache to figure this out on its own.') . '
'; $output .= '
'; diff --git a/core/modules/dynamic_page_cache/src/EventSubscriber/DynamicPageCacheSubscriber.php b/core/modules/dynamic_page_cache/src/EventSubscriber/DynamicPageCacheSubscriber.php index d5f0e3a..c0c3399 100644 --- a/core/modules/dynamic_page_cache/src/EventSubscriber/DynamicPageCacheSubscriber.php +++ b/core/modules/dynamic_page_cache/src/EventSubscriber/DynamicPageCacheSubscriber.php @@ -192,7 +192,7 @@ public function onResponse(FilterResponseEvent $event) { return; } - // Don't cache the response if the Dynamic Page CAche request & response + // Don't cache the response if the Dynamic Page Cache request & response // policies are not met. // @see onRouteMatch() if ($request->attributes->get(self::ATTRIBUTE_REQUEST_POLICY_RESULT) === RequestPolicyInterface::DENY || $this->responsePolicy->check($response, $request) === ResponsePolicyInterface::DENY) { @@ -217,6 +217,12 @@ public function onResponse(FilterResponseEvent $event) { * indicate poor cacheability, and if it doesn't make sense to cache parts of * a page, then neither does it make sense to cache an entire page. * + * But note that auto-placeholdering avoids such cacheability metadata ever + * bubbling to the response level: while rendering, the Renderer checks every + * subtree to see if meets the auto-placeholdering conditions. If it does, it + * is automatically placeholdered, and consequently the cacheability metadata + * of the placeholdered content does not bubble up to the response level. + * * @param \Drupal\Core\Cache\CacheableResponseInterface * The response whose cacheability to analyze. * @@ -309,7 +315,7 @@ public static function getSubscribedEvents() { // Run after AuthenticationSubscriber (necessary for the 'user' cache // context) and MaintenanceModeSubscriber (Dynamic Page Cache should not be // polluted by maintenance mode-specific behavior), but before - // ContentControllerSubscriber (updates _controller, but that is pointless + // ContentControllerSubscriber (updates _controller, but that is a no-op // when Dynamic Page Cache runs). $events[KernelEvents::REQUEST][] = ['onRouteMatch', 27]; diff --git a/core/modules/dynamic_page_cache/src/PageCache/ResponsePolicy/DenyAdminRoutes.php b/core/modules/dynamic_page_cache/src/PageCache/ResponsePolicy/DenyAdminRoutes.php index d79b659..7e453ee 100644 --- a/core/modules/dynamic_page_cache/src/PageCache/ResponsePolicy/DenyAdminRoutes.php +++ b/core/modules/dynamic_page_cache/src/PageCache/ResponsePolicy/DenyAdminRoutes.php @@ -16,9 +16,8 @@ * Cache policy for routes with the '_admin_route' option set. * * This policy rule denies caching of responses generated for admin routes, - * because the cacheability metadata of most admin route responses is lacking, - * which would lead to stale content being shown and the site being perceived as - * broken. + * because admin routes have very low cache hit ratios due to low traffic and + * form submissions. */ class DenyAdminRoutes implements ResponsePolicyInterface { diff --git a/core/modules/dynamic_page_cache/src/Tests/DynamicPageCacheIntegrationTest.php b/core/modules/dynamic_page_cache/src/Tests/DynamicPageCacheIntegrationTest.php index 82854a0..5c174a8 100644 --- a/core/modules/dynamic_page_cache/src/Tests/DynamicPageCacheIntegrationTest.php +++ b/core/modules/dynamic_page_cache/src/Tests/DynamicPageCacheIntegrationTest.php @@ -115,7 +115,7 @@ public function testDynamicPageCache() { $this->drupalGet('dynamic-page-cache-test/cacheable-response/admin'); $this->assertFalse($this->drupalGetHeader(DynamicPageCacheSubscriber::HEADER), 'Response returned, cacheable response, admin route: Dynamic Page Cache is ignoring'); - // Max-age = 0 responses are ignored by SmDynamic Page Cache artCache. + // Max-age = 0 responses are ignored by Dynamic Page Cache. $this->drupalGet('dynamic-page-cache-test/html/uncacheable/max-age'); $this->assertEqual('UNCACHEABLE', $this->drupalGetHeader(DynamicPageCacheSubscriber::HEADER), 'Render array returned, rendered as HTML response, but uncacheable: Dynamic Page Cache is running, but not caching.'); diff --git a/core/modules/page_cache/page_cache.info.yml b/core/modules/page_cache/page_cache.info.yml index 6999544..ba18ed6 100644 --- a/core/modules/page_cache/page_cache.info.yml +++ b/core/modules/page_cache/page_cache.info.yml @@ -1,6 +1,6 @@ name: Internal Page Cache type: module -description: 'Caches entire pages for anonymous users. Works well for small to medium-sized websites.' +description: 'Caches pages for anonymous users. Use when an external page cache is not available.' package: Core version: VERSION core: 8.x