Commit 71548cff authored by robertDouglass's avatar robertDouglass

Renaming global variable to conform with coding standards. Extending statistics tracking.

parent 597ee481
<?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,9 @@ $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;
$_memcache_statistics['bins'][] = $bin;
if ($mc = dmemcache_object($bin)) {
$full_key = dmemcache_key($key, $bin);
if (!$mc->set($full_key, $value, TRUE, $exp)) {
......@@ -46,13 +47,14 @@ 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;
$_memcache_statistics['bins'][] = $bin;
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;
}
......
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