Updated device cache support (#10795)

* Device Cache
also some additional device related models

* attribs from cache

* replace common attribute functions

* remove legacy cache usage
tidy up some collection manipulation
remove some unused or single use functions

* cleanup some items

* always return a device, to prevent bugs

* clear device cache when testing after each test

* fix double assignment

* Clean up function to take advantage of null object
This commit is contained in:
Tony Murray
2019-11-14 21:56:06 +00:00
committed by Neil Lathwood
parent d1c73b14f3
commit dec9a498ee
20 changed files with 311 additions and 132 deletions

View File

@ -5,13 +5,6 @@
// It would be interesting to know where this is used. It probably should have its own API.
use LibreNMS\ObjectCache;
foreach (dbFetchRows('SELECT * FROM `devices` ORDER BY `hostname`') as $device) {
$cache['devices']['hostname'][$device['hostname']] = $device['device_id'];
$cache['devices']['id'][$device['device_id']] = $device;
$cache['device_types'][$device['type']]++;
}
$devices = new ObjectCache('devices');
$ports = new ObjectCache('ports');
$services = new ObjectCache('services');