5

In /admin/config/development/performance settings page, my "cache blocks" options is disabled due to "Block caching is inactive because you have enabled modules defining content access restrictions."

But I absolutely need to globally cache some blocks (in particular some superfish blocks because they recreates menu items on every page load if not cached).

I've already tried Block Cache Alter module, but without success, probably because this module can works only if system "cache block" option is enabled (see: https://drupal.org/node/1954224 )

Thank you for help

2 Answers 2

7

With latest Drupal 7.33 release there is a new setting variable now:

/**
 * Block caching:
 *
 * Block caching may not be compatible with node access modules depending on
 * how the original block cache policy is defined by the module that provides
 * the block. By default, Drupal therefore disables block caching when one or
 * more modules implement hook_node_grants(). If you consider block caching to
 * be safe on your site and want to bypass this restriction, uncomment the line
 * below.
 */

$conf['block_cache_bypass_node_grants'] = TRUE;

Setting the above to TRUE the "cache blocks" option becomes checkable.

3

block_form_system_performance_settings_alter() is where that code lives. Looking into it you can force this by running variable_set('block_cache', TRUE); once or by adding $conf['block_cache'] = TRUE; to your settings.php file (near the bottom). I would opt for the settings.php method.

Core Issue for this as well: https://drupal.org/node/1930960 (Now in 7.33). See MXT's answer on how to use it.

Note that by doing this bad things might happen. You have been warned.

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.