/** * Get global default prefix * * @param string $namespace * * @return string */ static public function getDefaultPrefix($namespace = null) { $ret = null; if (!empty($GLOBALS['drupal_test_info']['test_run_id'])) { $ret = $GLOBALS['drupal_test_info']['test_run_id']; } else { $prefixes = variable_get('cache_prefix', null); if (is_string($prefixes)) { // Variable can be a string which then considered as a default // behavior. $ret = $prefixes; } else if (null !== $namespace && isset($prefixes[$namespace])) { if (false !== $prefixes[$namespace]) { // If entry is set and not false an explicit prefix is set // for the bin. $ret = $prefixes[$namespace]; } else { // If we have an explicit false it means no prefix whatever // is the default configuration. $ret = ''; } } else { // Key is not set, we can safely rely on default behavior. if (isset($prefixes['default']) && false !== $prefixes['default']) { $ret = $prefixes['default']; } else { // When default is not set or an explicit false this means // no prefix. $ret = ''; } } } if (empty($ret)) { $ret = Redis_Client::getGlobalPrefix(); } return $ret; }