I have a site which contains a custom block. The custom block contains a menu based on a sub-set of the site's main menu. The problem is that main menu is very large (~1300 items), so generating this particular menu in the block, is quite costly. According to hook_block_info() the block is configured to use DRUPAL_CACHE_PER_PAGE | DRUPAL_CACHE_PER_ROLE caching methods.

If I go to the site's performance configuration page I notice that the "Cache block" option is disabled; However, the "Cache pages for anonymous users" option is enabled.

In such a situation would the block be cached or not? If it is cached, then would that only be for anonymous users?

1 Answer 1


TL;DR yes

Well, not per se. But page it appears on is cached, including that block. There is no separate item for the block in any cache in situation you described, but it won't be recreated anyway. Code for it won't be executed. And yes, in default Drupal configuration page caches works only for anonymous users.

  • So what your saying is that the block caching rules are not being applied at all? The block is only being cached in the context of the page being cache rather than the block itself. That would explain why the page loading performance is not being overly affected even though the block itself is not cached.
    – Benjen
    Aug 7, 2015 at 7:56
  • @Benjen I'm only saying block caching rules are important if page is not cached as a whole. I think you got it about right.
    – Mołot
    Aug 7, 2015 at 7:58

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.