icinga-powershell-framework/lib/core/perfcounter/Icinga_GlobalPerfCounterCache.psm1
Christian Stein 4ada0d69f9 Adds Performance Counter cache
Implements #96
2020-08-07 15:17:19 +02:00

39 lines
819 B
PowerShell

function New-IcingaPerformanceCounterCache()
{
if ($null -eq $global:Icinga_PerfCounterCache) {
$global:Icinga_PerfCounterCache = (
[hashtable]::Synchronized(
@{}
)
);
}
}
function Add-IcingaPerformanceCounterCache()
{
param (
$Counter,
$Instances
);
if ($global:Icinga_PerfCounterCache.ContainsKey($Counter)) {
$global:Icinga_PerfCounterCache[$Counter] = $Instances;
} else {
$global:Icinga_PerfCounterCache.Add(
$Counter, $Instances
);
}
}
function Get-IcingaPerformanceCounterCacheItem()
{
param (
$Counter
);
if ($global:Icinga_PerfCounterCache.ContainsKey($Counter)) {
return $global:Icinga_PerfCounterCache[$Counter];
}
return $null;
}