function DrupalAPCCache::__construct in APC - Alternative PHP Cache 7
File
- ./
drupal_apc_cache.inc, line 85 - This integrates the drupal APC cache backend.
Class
- DrupalAPCCache
- APC cache implementation.
Code
function __construct($bin) {
$this->bin = $bin;
$this->drush = drupal_is_cli() && function_exists('drush_log');
// First we determine the prefix from a setting.
$prefix = self::getPrefixSettingForBin($this->bin);
// If we do not have a configured prefix we use the HTTP_HOST.
if (empty($prefix) && isset($_SERVER['HTTP_HOST'])) {
// Provide a fallback for multisite. This is on purpose not inside the
// getPrefixForBin() function in order to decouple the unified prefix
// variable logic and custom module related security logic, that is not
// necessary for all backends.
$prefix = $_SERVER['HTTP_HOST'] . '::';
}
else {
$prefix = $prefix . '::';
}
// When we are in testing mode we add the test prefix.
if ($test_prefix = drupal_valid_test_ua()) {
$prefix = $test_prefix . '::' . $prefix;
}
else {
if (isset($GLOBALS['drupal_test_info'])) {
$prefix = $GLOBALS['drupal_test_info']['test_run_id'] . '::' . $prefix;
}
}
$this->prefix = $prefix;
}