Drupal - How does Drupal 7 page/block cache work?

From your question I get that you are trying to set the caching from the performance page admin/config/development/performance.

Cache pages for anonymous users only works for anonymous users, and the page markup is stored in database (to reduce the number of queries). And you can check the HTTP Header X-Drupal-Cache to see if this cache is HIT.

Cache blocks (if Page caching is disabled) works for anonymous and logged-in users. And again, the whole block markup is stored in database for the same reason.

Minimum cache lifetime is the amount of time before the Page cache gets cleared (the cache is cleared on cron run).

Expiration of cached pages works only if page caching is enabled and is only applied to external caching mechanisms (like the browser cache)


There is a lot of confusion about how settings such as Minimum cache lifetime works. The best description I have found on it is this article by Brian Osborne. This article is a must read for anyone getting their heads around how caching in Drupal core works.

In your example, if you set the Minimum cache lifetime to 15 mins. The first time a cache clear is triggered (e.g. you edit a node, create new comment, etc.) Drupal will preserve the existing cached page (if it already exists) and note the current time. The next time an action which triggers a cache clear is called it will compare the current time with the previously noted time. If the elapsed time has exceeded 15 mins the cache (including pages and block cache) will be cleared.

Tags:

Caching