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

13 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.
BlockBase::__construct in drupal/core/modules/block/lib/Drupal/block/BlockBase.php
Constructs a Drupal\Component\Plugin\PluginBase object.
BlockCacheTest::testNoCache in drupal/core/modules/block/lib/Drupal/block/Tests/BlockCacheTest.php
Test DRUPAL_NO_CACHE.
BlockInterfaceTest::testBlockInterface in drupal/core/modules/block/lib/Drupal/block/Tests/BlockInterfaceTest.php
Test configuration and subsequent form() and build() method calls.

... See full list

File

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

Code

const DRUPAL_NO_CACHE = -1;