I have a site that is cached for anonymous users. However it seems that something clears caches every now and then (many times daily.) And it is not result of admins activity. I found about it only by chance, when looking at page_cache table, refreshed it after a while and all records were gone. Question: how to start debugging this? What can I do to track what user action or anything causes caches to be cleared? Thank you.

2 Answers 2


Have you checked whether Cron is configured on your site under Configuration options.

When trying to speed up my site, this article was very useful as Cron will clear cache.


  • Hi, cron is configured to run once a day. I ruled it out.
    – loparr
    Oct 8, 2015 at 16:41

If your cache is cleared on every page, this can be triggered by:

Rebuild the theme registry on every page load

provided by Devel. Try to disable it in Appearance.

Check also your cron tasks.

Since there is no hook on cache clearing (at least not in Drupal 6-7), so debugging this is a bit tricky.

If you really wants to do this (at least not on the Production), enable Devel module, then add:


into hook_flush_caches() (or drupal_flush_all_caches() - not advised).

Note: dd works for Drupal 5-8

To save some space, you can use debug_backtrace(DEBUG_BACKTRACE_PROVIDE_OBJECT, 3) instead to limit the number of stack frames returned (PHP >= 5.4.0).

This will log all functions/modules which performed clear caching in /tmp/drupal-debug.txt.

To check in real-time once you're using your site, try:

tail -f /tmp/drupal-debug.txt
  • Hi, no cache is not cleared on every page, devel is not installed. I am on D6, will this tracking work for d as well?
    – loparr
    Oct 8, 2015 at 17:50
  • @loparr dd works for all Drupal 5-8, and debuggers for all versions.
    – kenorb
    Oct 8, 2015 at 17:53

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.