protected static function MemcacheStorageAPI::finalDebugActions in Memcache Storage 7
Last step of debug logging.
Parameters
$method: Memcache action name. For example, 'set'.
$cache_bin: Cache bin name where action performs.
$cache_id: Unprocessed Cache ID.
$memcache_id: Processed Cache ID right before memcache action.
$result: Results of action execution.
6 calls to MemcacheStorageAPI::finalDebugActions()
- MemcacheStorageAPI::add in ./
memcache_storage.api.inc - Save data into memcached pool if key doesn't exist. Provide debug logging.
- MemcacheStorageAPI::delete in ./
memcache_storage.api.inc - Delete value from memcached pool. Provide debug logging.
- MemcacheStorageAPI::deleteMultiple in ./
memcache_storage.api.inc - Delete multiple cache items from memcached pool. Provide debug logging.
- MemcacheStorageAPI::getMultiple in ./
memcache_storage.api.inc - Get values from memcache storage. Provide debug logging.
- MemcacheStorageAPI::replace in ./
memcache_storage.api.inc - Replace existing data in memcache pool. Provide debug logging.
File
- ./
memcache_storage.api.inc, line 628 - Provide class that processes memcached operations.
Class
- MemcacheStorageAPI
- Integrates with memcache API.
Code
protected static function finalDebugActions($method, $cache_bin, $cache_id, $memcache_id, $result) {
// Stop count timer.
timer_stop(self::$debug_key);
// Calculate memory usage.
$mem_usage =& drupal_static('memcache_storage_debug_mem_usage', array());
$used_memory = memory_get_usage() - $mem_usage[self::$debug_key];
// Processes cache bin name (remove suffix _[INDEX] if exists).
$cache_bin_original = self::normalizeCacheBin($cache_bin);
// Get array with debug data.
$memcache_storage_debug_output =& drupal_static('memcache_storage_debug_output');
if (is_string($cache_id)) {
$cache_id = array(
$cache_id,
);
}
// Log entries about memcache action.
foreach ($cache_id as $cid) {
$unique_class = str_replace(array(
' ',
'_',
'/',
'[',
']',
':',
), '-', $cache_bin . '-' . $cid);
$clear_link = array(
'#theme' => 'link',
'#text' => 'Delete',
'#path' => 'memcache_storage/delete/nojs/' . $cache_bin . '/' . $cid,
'#options' => array(
'attributes' => array(
'class' => array(
'use-ajax',
$unique_class,
),
),
'html' => FALSE,
),
);
// Get result string (HIT or MISS).
if (is_array($result)) {
$result_status = isset($result[$cid]) && $result[$cid] !== Memcached::RES_NOTFOUND;
$result_string = !empty($result_status) ? 'HIT' : 'MISS';
}
else {
$result_string = $result ? 'HIT' : 'MISS';
}
$memcache_storage_debug_output[] = array(
'action' => count($cache_id) > 1 ? $method . 'Multiple' : $method,
'timer' => timer_read(self::$debug_key),
'memory' => $used_memory,
'result' => $result_string,
'bin' => $cache_bin_original,
'cid' => $cid,
'mem_key' => is_array($memcache_id) ? array_search($cid, $memcache_id) : $memcache_id,
'clear_link' => $cid != 'memcache_storage_bin_indexes' ? $clear_link : '',
'token' => $cache_bin . '-' . $cid,
);
}
// Increase timer to get new time results.
self::$debug_key++;
}