function dmemcache_extension in Memcache API and Integration 7
Same name and namespace in other branches
- 6 dmemcache.inc \dmemcache_extension()
Determine which memcache extension to use: memcache or memcached.
By default prefer the 'Memcache' PHP extension, though the default can be overridden by setting memcache_extension in settings.php.
6 calls to dmemcache_extension()
- dmemcache_close in ./
dmemcache.inc - Close the connection to the memcache instance.
- dmemcache_connect in ./
dmemcache.inc - Initiate a connection to memcache.
- dmemcache_instance in ./
dmemcache.inc - Return a new memcache instance.
- memcache_requirements in ./
memcache.install - Implements hook_requirements().
- _dmemcache_use_ascii_auth in ./
dmemcache.inc - Returns whether memcache_ascii_auth is used or not.
File
- ./
dmemcache.inc, line 704 - A memcache API for Drupal.
Code
function dmemcache_extension() {
static $extension = NULL;
if ($extension === NULL) {
// If an extension is specified in settings.php, use that when available.
$preferred = variable_get('memcache_extension', NULL);
if (isset($preferred) && class_exists($preferred, FALSE)) {
$extension = ucfirst(strtolower($preferred));
}
elseif (class_exists('Memcache', FALSE)) {
$extension = 'Memcache';
}
elseif (class_exists('Memcached', FALSE)) {
$extension = 'Memcached';
}
else {
$extension = FALSE;
}
}
return $extension;
}