public function MemCacheDrupal::__construct in Memcache API and Integration 7
Constructs a MemCacheDrupal object.
Parameters
string $bin: The cache bin for which the object is created.
File
- ./
memcache.inc, line 28
Class
- MemCacheDrupal
- Implementation of cache.inc with memcache logic included
Code
public function __construct($bin) {
$this->memcache = dmemcache_object($bin);
$this->bin = $bin;
// If page_cache_without_database is enabled, we have to manually load the
// $conf array out of cache_bootstrap.
static $variables_loaded = FALSE;
// NOTE: We don't call drupal_get_bootstrap_phase() because this would
// break all 7.x Drupal installations prior to 7.33. For more information
// see https://www.drupal.org/node/667098.
if (drupal_bootstrap(NULL, FALSE) < DRUPAL_BOOTSTRAP_VARIABLES && !$variables_loaded) {
global $conf;
$variables_loaded = TRUE;
// Try loading variables from cache. If that fails, we have to bootstrap
// further in order to fetch them.
if ($cached = cache_get('variables', 'cache_bootstrap')) {
$variables = $cached->data;
// Make sure variable overrides are applied, see variable_initialize().
foreach ($conf as $name => $value) {
$variables[$name] = $value;
}
$conf = $variables;
}
else {
drupal_bootstrap(DRUPAL_BOOTSTRAP_VARIABLES, FALSE);
}
}
$this
->reloadVariables();
}