Drupal has one of the most sophisticated caching systems of any CMS, and that is part of why caching conversations get confusing. Page cache, dynamic page cache, render cache, cache bins, Varnish, CDN, Redis, Memcached: they are all real, they all do different jobs, and a site rarely needs all of them configured the same way. This article lays out the layers from the visitor inward, then explains what to use for different kinds of sites.
The layers, from the visitor inward
| Layer | What it caches | Who benefits |
|---|---|---|
| Browser | Assets and, briefly, pages | Repeat visits by one person |
| CDN | Full pages and assets at edge locations | Anonymous visitors everywhere |
| Reverse proxy (such as Varnish) | Full pages in front of the web servers | Anonymous visitors, when there is no CDN or as a second tier |
| Internal Page Cache | Full pages inside Drupal | Anonymous visitors |
| Dynamic Page Cache | Pages minus personalized parts | Logged-in users |
| Render cache | Individual blocks, entities, and elements | Everyone, including logged-in users |
| Cache backend (database, Redis, or Memcached) | Where all of Drupal's cache bins are stored | Every request that uses any Drupal cache |
How Drupal keeps caches accurate
Caching is only safe if stale content is cleared at the right moment. Drupal attaches metadata to everything it renders:
- Cache tags say what content a piece of output depends on, such as
node:42. When node 42 changes, everything tagged with it is invalidated, and nothing else. - Cache contexts say what the output varies by, such as the user's role, language, or URL.
- Max-age says how long the output stays valid.
This lets Drupal invalidate precisely rather than clearing everything. The Purge module family extends the same tags to Varnish and CDNs, so editing one page clears just the cached pages that show it, all the way out to the edge.
A common pitfall: a single block that sets max-age to zero, often a custom block showing something "live", makes the entire page uncacheable for the Internal Page Cache. If anonymous pages are slow, look for that first.
Redis or Memcached?
By default Drupal stores its cache bins in database tables, which adds load to the database and grows those tables quickly on busy sites. Moving the cache backend to memory is one of the most effective changes you can make. Both options work well:
- Memcached is simple, fast, and purely a cache. It is a long-standing choice for Drupal and does one job well.
- Redis is equally fast for caching and also supports persistence and richer data types, so it can hold other things such as queues or sessions. It is widely available as a managed cloud service.
For most new builds, Redis is the practical default because the same service can cover several needs. If a site already runs well on Memcached, there is rarely a reason to switch. What matters more is sizing the cache so it is not constantly evicting entries, and giving each site its own key prefix if several share one service.
What to use for which site
| Site type | Priorities |
|---|---|
| Mostly anonymous public site (a city, a college) | CDN with tag-based purging, Internal Page Cache, a memory cache backend |
| Heavy logged-in use (intranet, portal, membership) | Dynamic Page Cache and render cache working well, a well-sized memory cache backend, careful use of cache contexts |
| Frequently changing content (news, alerts) | Short max-age on HTML at the edge plus tag-based purging so updates appear immediately |
| Multi-site platform | Shared memory cache with a strict prefix per site; purging scoped per site |
Signs a layer is not doing its job
- Anonymous pages show no
X-Drupal-Cache: HITor CDN hit headers. - The
cache_tables in the database are large and busy. - Editors wait for changes to appear, or someone clears all caches several times a day.
When in doubt, measure before tuning. Response headers, the cache hit ratio in Redis or Memcached, and page timings for anonymous and logged-in users show which layer is underperforming, so effort goes where it makes a difference.
How eWay configures Drupal caching
eWay chooses caching layers per workload rather than applying one template. Typically that is a CDN with tag-based purging in front, Drupal's page and dynamic caches tuned, and Redis or Memcached as the cache backend, sized and monitored for hit ratio and evictions. eWay also audits custom code for cache metadata problems that quietly disable caching.
What to include in a support ticket
- The severity you would assign, P1 to P4 (see severity levels and response times)
- Whether the issue is stale content or slow pages, and for anonymous or logged-in users
- Example URLs and response headers
eWay customers can open a ticket in the support portal or email support@ewaycorp.com at any time. See how to request support for all the options. Related reading: object caching with Redis and page caching and CDN behavior. More on our Drupal page.
Was this article helpful?
That’s Great!
Thank you for your feedback
Sorry! We couldn't be helpful
Thank you for your feedback
Feedback sent
We appreciate your effort and will try to fix the article