You are here

function performance_enabled_memcache in Performance Logging and Monitoring 7

Same name and namespace in other branches
  1. 6 performance.module \performance_enabled_memcache()

Helper function to check if Memcache is available.

Parameters

$form whether or not we're called from the settings form:

$message whether or not to display an additional message:

Return value

boolean

See also

performance_data_stores()

File

./performance.module, line 596
Logs detailed and/or summary page generation time and memory consumption for page requests. Copyright Khalid Baheyeldin 2008 of http://2bits.com

Code

function performance_enabled_memcache($form = FALSE, $message = FALSE) {
  global $conf;
  $setting = variable_get('performance_summary_memcache', 0);
  if ($form) {
    $setting = TRUE;
  }
  if (function_exists('dmemcache_set') && $setting) {
    if (isset($conf['memcache_bins']['cache_performance'])) {
      return TRUE;
    }
    elseif ($message) {
      $message = t("Memcache detected, but no specific 'cache_performance' bin has been defined. See README.txt for configuration details.");
      drupal_set_message($message, 'warning', FALSE);
      return FALSE;
    }
  }
}