Drupal Caching
Philosophy: Configuration first. Prioritize declarative caching (cache metadata in render arrays, config schema for cache backends) over programmatic approaches.
I need to...
| I need to... | Guide |
|---|---|
| Understand Drupal's caching layers and when to use each | Cache System Overview |
| Learn the three pillars of cache metadata | Cache Metadata Trinity |
| Add cache tags to invalidate on entity/config changes | Cache Tags |
| Vary cached content by URL, user, language, etc. | Cache Contexts |
| Set how long content can be cached | Cache Max-Age |
| Choose and configure a cache backend (Redis, Memcache, APCu) | Cache Backends |
| Understand cache bins and their purposes | Cache Bins |
| Cache render arrays and understand render caching | Render Caching |
| Handle cache metadata bubbling in nested render arrays | BubbleableMetadata & Cache Bubbling |
| Defer expensive rendering with placeholders | Lazy Builders |
| Understand anonymous page caching | Page Cache |
| Cache pages for authenticated users | Dynamic Page Cache |
| Progressively render expensive content | BigPipe |
| Invalidate caches when data changes | Cache Invalidation Patterns |
| Create and invalidate custom cache tags | Custom Cache Tags |
| Configure Redis or Memcache backends in settings.php | Cache Backend Configuration |
| Follow caching best practices | Best Practices & Patterns |
| Avoid common caching mistakes | Anti-Patterns & Common Mistakes |
| Ensure cache security and performance | Security & Performance |
| Find core cache files and APIs | Code Reference Map |