The HTTP response headers X-Drupal-Cache
and X-Drupal-Dynamic-Cache
are used by Drupal to indicate the status of its caching layers for the page that was requested.
Here's what each of these headers means:
-
X-Drupal-Cache: HIT
indicates that the page was served from Drupal's internal page cache. This typically means that the page did not have to be fully rebuilt from scratch and was instead retrieved from a previously cached version, which usually results in a faster response time. -
X-Drupal-Dynamic-Cache: MISS
suggests that the requested page did not hit Drupal's dynamic page cache. The dynamic page cache in Drupal is a system that caches page content for authenticated traffic, varying by user roles, permissions, and other factors. A MISS means that the dynamic elements of the page had to be generated on the fly rather than being served from cache.
The combination of these headers tells you that the static part of the page was successfully retrieved from the cache (HIT
), but the dynamic portions of the page were not found in the dynamic cache and had to be generated at the time of the request (MISS
).
To optimize your site performance, you typically want to aim for a HIT on both headers, where possible. However, this might not always be feasible for highly dynamic content or pages that change frequently based on user interactions or other variables. In those cases, a MISS for dynamic cache might be expected behavior.
You can work on your Drupal 10 site caching strategy to improve the dynamic cache hit rate by investigating what parts of your pages are dynamic and how you can optimize them, perhaps by using cache tags, contexts, and max-age directives that allow for more granular caching.