function dmemcache_serialize_extension in Memcache API and Integration 7
Determine which serialize extension to use: serialize (none), igbinary, or msgpack.
By default we prefer the igbinary extension, then the msgpack extension, then the core serialize functions. This can be overridden in settings.php.
3 calls to dmemcache_serialize_extension()
- dmemcache_serialize in ./
dmemcache.inc - Return proper serialize function.
- dmemcache_unserialize in ./
dmemcache.inc - Return proper unserialize function.
- memcache_admin_stats in memcache_admin/
memcache_admin.module - Callback for the Memcache Stats page.
File
- ./
dmemcache.inc, line 733 - A memcache API for Drupal.
Code
function dmemcache_serialize_extension() {
static $extension = NULL;
if ($extension === NULL) {
$preferred = strtolower(variable_get('memcache_serialize', NULL));
// Fastpath if we're forcing php's own serialize function.
if ($preferred == 'serialize') {
$extension = $preferred;
}
else {
$igbinary_available = extension_loaded('igbinary');
$msgpack_available = extension_loaded('msgpack');
if ($preferred == 'igbinary' && $igbinary_available) {
$extension = $preferred;
}
elseif ($preferred == 'msgpack' && $msgpack_available) {
$extension = $preferred;
}
else {
// No (valid) serialize extension specified, try igbinary.
if ($igbinary_available) {
$extension = 'igbinary';
}
else {
if ($msgpack_available) {
$extension = 'msgpack';
}
else {
$extension = 'serialize';
}
}
}
}
}
return $extension;
}