Cloud Next enables Drupal’s layered cache backend by default for all Drupal 9 and later applications to provide significant performance improvements. This document explains how layered caching works on the platform, its impact on your application, and how you can manage your caching configuration.
How layered caching works¶
Layered caching introduces a fast, in-memory cache backend (APCu) that sits in front of the shared Memcache service. When a cache item is requested, Drupal first checks the local APCu cache. If the item is not found, Drupal checks Memcache. For more information, visit ChainedFastBackend.
This two-tier system means that frequently-accessed cache items are served directly from a local cache to the web service, which reduces network latency and load on the Memcache service and results in faster page loads for end users.
Impact¶
For most applications, this change improves performance with no negative side effects. However, applications with highly customized caching configurations in their settings.php
file may be affected. If your application code overrides Drupal's cache services or expects a specific caching backend, the introduction of this platform-managed layer might lead to unexpected behavior.
Managing your caching configuration¶
Acquia strongly recommends that you review your application's caching configuration in a non-production environment to ensure compatibility with this change.
Disabling layered caching¶
If you discover an incompatibility or want to manage your own caching backend, you can override the platform default behavior and revert to using Memcache directly. To disable the layered cache, add the following snippet to your application's settings.php
file:
// Use memcache for bootstrap, discovery, config instead of fast chained
// backend to properly invalidate caches on multiple webs.
// See https://www.drupal.org/node/2754947
$settings['cache']['bins']['bootstrap'] = 'cache.backend.memcache';
$settings['cache']['bins']['discovery'] = 'cache.backend.memcache';
$settings['cache']['bins']['config'] = 'cache.backend.memcache';
This ensures that your application bypasses the APCu fast cache backend and uses only Memcache, overriding the default behavior.