Commit 9621c2db authored by lyricnz's avatar lyricnz
Browse files

Update statistics variable name. See Coding Standards http://drupal.org/node/318

"If you need to define global variables, their name should start with a single underscore followed by the module/theme name and another underscore"
parent c9fe2012
<?php
// $ID$
global $memcache_statistics;
$memcache_statistics = array('get' => array(), 'set' => array(), 'hit' => array());
global $_memcache_statistics;
$_memcache_statistics = array('get' => array(), 'set' => array(), 'hit' => array());
/*
* A memcache API for Drupal.
......@@ -23,8 +23,8 @@ $memcache_statistics = array('get' => array(), 'set' => array(), 'hit' => array(
* @return bool
*/
function dmemcache_set($key, $value, $exp = 0, $bin = 'cache') {
global $memcache_statistics;
$memcache_statistics['set'][] = $key;
global $_memcache_statistics;
$_memcache_statistics['set'][] = $key;
if ($mc = dmemcache_object($bin)) {
$full_key = dmemcache_key($key, $bin);
if (!$mc->set($full_key, $value, TRUE, $exp)) {
......@@ -46,13 +46,13 @@ function dmemcache_set($key, $value, $exp = 0, $bin = 'cache') {
* @return The item which was originally saved or FALSE
*/
function dmemcache_get($key, $bin = 'cache') {
global $memcache_statistics;
$memcache_statistics['get'][] = $key;
global $_memcache_statistics;
$_memcache_statistics['get'][] = $key;
if ($mc = dmemcache_object($bin)) {
$full_key = dmemcache_key($key, $bin);
$result = $mc->get($full_key);
if ($result) {
$memcache_statistics['hit'][] = $key;
$_memcache_statistics['hit'][] = $key;
}
return $result;
}
......
......@@ -16,7 +16,7 @@ function memcache_init() {
* Displays memcache stats in the footer.
*/
function memcache_shutdown() {
global $user, $memcache_statistics;
global $user, $_memcache_statistics;
$output = '';
......@@ -30,7 +30,7 @@ function memcache_shutdown() {
if ($user->uid == 1) {
$stats = array();
foreach ($memcache_statistics as $stat => $val) {
foreach ($_memcache_statistics as $stat => $val) {
$stats[] = "<strong>$stat:</strong> ". theme('item_list', $val);
}
if (!empty($stats)) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment