function _dmemcache_write_debug in Memcache API and Integration 7
Write to a debug log when enabled.
Parameters
string $action: The action being performed (get, set, etc...).
string $bin: The memcache bin the action is being performed in.
string $key: The key on which the action is being performed on.
bool $rc: The return code of the action performed.
6 calls to _dmemcache_write_debug()
- dmemcache_add in ./
dmemcache.inc - Add an item into memcache.
- dmemcache_delete in ./
dmemcache.inc - Deletes an item from the cache.
- dmemcache_flush in ./
dmemcache.inc - Flush all stored items.
- dmemcache_get in ./
dmemcache.inc - Retrieve a value from the cache.
- dmemcache_get_multi in ./
dmemcache.inc - Retrieve multiple values from the cache.
File
- ./
dmemcache.inc, line 1308 - A memcache API for Drupal.
Code
function _dmemcache_write_debug($action, $bin, $key, $rc) {
static $memcache_debug_log = NULL;
static $memcache_debug_verbose = NULL;
if ($memcache_debug_log === NULL) {
$memcache_debug_log = variable_get('memcache_debug_log', FALSE);
$memcache_debug_verbose = variable_get('memcache_debug_verbose', FALSE);
}
if (($action == 'get' || $action == 'getMulti') && !$memcache_debug_verbose) {
return;
}
elseif ($memcache_debug_log) {
$debug_log = strtr(variable_get('memcache_debug_log_format', "!timestamp|!action|!bin|!cid|!rc\n"), array(
'!timestamp' => date(variable_get('memcache_debug_time_format', 'U')),
'!action' => $action,
'!bin' => $bin,
'!cid' => $key,
'!rc' => (int) $rc,
));
if (file_put_contents($memcache_debug_log, $debug_log, FILE_APPEND) === FALSE) {
// This can lead to a lot of watchdog entries...
register_shutdown_function('watchdog', 'memcache', 'Unable to write to debug log at !debug_file: !debug_log.', array(
'!debug_file' => $memcache_debug_log,
'!debug_log' => $debug_log,
), WATCHDOG_ERROR);
}
}
}