Block Caching

  1. cis7 includes/ block_caching
  2. cle7 includes/ block_caching
  3. elmsmedia7 includes/ block_caching
  4. icor7 includes/ block_caching
  5. meedjum_blog7 includes/ block_caching
  6. mooc7 includes/ block_caching

Constants that define each block's caching state.

Modules specify how their blocks can be cached in their hook_block_info() implementations. Caching can be turned off (DRUPAL_NO_CACHE), managed by the module declaring the block (DRUPAL_CACHE_CUSTOM), or managed by the core Block module. If the Block module is managing the cache, you can specify that the block is the same for every page and user (DRUPAL_CACHE_GLOBAL), or that it can change depending on the page (DRUPAL_CACHE_PER_PAGE) or by user (DRUPAL_CACHE_PER_ROLE or DRUPAL_CACHE_PER_USER). Page and user settings can be combined with a bitwise-binary or operator; for example, DRUPAL_CACHE_PER_ROLE | DRUPAL_CACHE_PER_PAGE means that the block can change depending on the user role or page it is on.

The block cache is cleared in cache_clear_all(), and uses the same clearing policy than page cache (node, comment, user, taxonomy added or updated...). Blocks requiring more fine-grained clearing might consider disabling the built-in block cache (DRUPAL_NO_CACHE) and roll their own.

Note that user 1 is excluded from block caching.


Namesort descending Location Description
DRUPAL_CACHE_CUSTOM includes/ The block is handling its own caching in its hook_block_view().
DRUPAL_CACHE_GLOBAL includes/ The block or element is the same for every user and page that it is visible.
DRUPAL_CACHE_PER_PAGE includes/ The block or element can change depending on the page being viewed.
DRUPAL_CACHE_PER_ROLE includes/ The block or element can change depending on the user's roles.
DRUPAL_CACHE_PER_USER includes/ The block or element can change depending on the user.
DRUPAL_NO_CACHE includes/ The block should not get cached.


includes/, line 94
Common functions that many Drupal modules will need to reference.




Error message

  • Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/elmsln_community/ in drupal_send_headers() (line 1499 of /var/www/html/elmsln_community/
  • Error: Call to undefined function apc_delete() in DrupalAPCCache->clear() (line 289 of /var/www/html/elmsln_community/
The website encountered an unexpected error. Please try again later.