6

I have a few questions about drupal 7 page/block cache.

If I enable the cache and set the expiration time for 15min., and the content in page A is updated within next 10min., will the cached version be updated? or will it only update every 15min.?

Does same apply to blocks?

2 Answers 2

8

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)

2

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.