speedups to syslog page, caching of device_id

git-svn-id: http://www.observium.org/svn/observer/trunk@743 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
Adam Amstrong
2010-01-29 21:10:05 +00:00
parent 22f8cfe8e0
commit d02ade9ba6
6 changed files with 40 additions and 14 deletions

View File

@@ -24,6 +24,17 @@ require('collectd/config.php');
require('collectd/functions.php');
require('collectd/definitions.php');
function device_by_id_cache($device_id) {
global $device_cache;
if(is_array($device_cache[$device_id])) {
$device = $device_cache[$device_id];
} else {
$device = mysql_fetch_array(mysql_query("SELECT * FROM `devices` WHERE `device_id` = '".$device_id."'"));
$device_cache[$device_id] = $device;
}
return $device;
}
function mac_clean_to_readable($mac){
$r = substr($mac, 0, 2);