There is a variable 'page_cache_without_database' which is rather handy in that it can force Drupal to use page cache from settings.php, but it is rather poorly named. If you look at the code in bootstrap.inc where it is used you'll see that if you are using regular database caching this variable will (despite its name) actually enable database caching:

  // Check for a cache mode force from settings.php.
  if (variable_get('page_cache_without_database')) {
    $cache_enabled = TRUE;
  }
  else {
    drupal_bootstrap(DRUPAL_BOOTSTRAP_VARIABLES, FALSE);
    $cache_enabled = variable_get('cache');
  }
  drupal_block_denied(ip_address());
  // If there is no session cookie and cache is enabled (or forced), try
  // to serve a cached page.
  if (!isset($_COOKIE[session_name()]) && $cache_enabled) {
    // Make sure there is a user object because its timestamp will be
    // checked, hook_boot might check for anonymous user etc.
    $user = drupal_anonymous_user();
    // Get the page from the cache.
    $cache = drupal_page_get_cache();
    // If there is a cached page, display it.

This function appears to do two things, enable cache, and not load variables from the database. However, that isn't really what its name implies. Am I wrong in how this functions?

Comments

marcingy’s picture

Version: 7.4 » 8.x-dev
Category: bug » task
Issue tags: +Needs backport to D7

Nothing is broken so this is a task and needs to be fixed in d8 first

joachim’s picture

'cache_enabled_pre_bootstrap'?

soyarma’s picture

One other note that I did discover is that if you use this variable Drupal does not output cachable headers (which means things like varnish won't cache the page). You still have to check off the caching checkbox on the performance page to get that :S

joachim’s picture

Could also probably do with some documentation in settings.php.

znerol’s picture

mgifford’s picture

Maybe it will... cache_enabled_pre_bootstrap doesn't deal with not loading variables, but that might not matter.

Berdir’s picture

Status: Active » Closed (duplicate)

#2368987: Move internal page caching to a module to avoid relying on config get on runtime will remove this setting. And I don't see how something like this would be backported, so closing as duplicate.