constant DRUPAL_NO_CACHE

The block should not get cached.

This setting should be used:

  • For simple blocks (notably those that do not perform any db query), where querying the db cache would be more expensive than directly generating the content.
  • For blocks that change too frequently.

Related topics

17 uses of DRUPAL_NO_CACHE
Block::defineOptions in drupal/core/modules/block/lib/Drupal/block/Plugin/views/display/Block.php
Information about options for all kinds of purposes will be held here. @code 'option_name' => array(
Block::getCacheType in drupal/core/modules/block/lib/Drupal/block/Plugin/views/display/Block.php
Provide a single method to figure caching type, keeping a sensible default for when it's unset.
BlockCacheTest::testNoCache in drupal/core/modules/block/lib/Drupal/block/Tests/BlockCacheTest.php
Test DRUPAL_NO_CACHE.
BlockTest::testBlockRehash in drupal/core/modules/block/lib/Drupal/block/Tests/BlockTest.php
Test _block_rehash().
block_add_block_form_submit in drupal/core/modules/block/block.admin.inc
Form submission handler for block_add_block_form().

... See full list

File

drupal/core/includes/common.inc, line 142
Common functions that many Drupal modules will need to reference.

Code

const DRUPAL_NO_CACHE = -1;