#MANTIS - Make DLINK caching (DEV version) configureable

This commit is contained in:
Applevangelist 2025-05-15 08:51:44 +02:00
parent acbcb14cba
commit f8947aab9c

View File

@ -2324,7 +2324,7 @@ INTEL_DLINK = {
verbose = 0, verbose = 0,
lid = nil, lid = nil,
alias = nil, alias = nil,
cachetime = 300, cachetime = 120,
interval = 20, interval = 20,
contacts = {}, contacts = {},
clusters = {}, clusters = {},
@ -2333,7 +2333,7 @@ INTEL_DLINK = {
--- Version string --- Version string
-- @field #string version -- @field #string version
INTEL_DLINK.version = "0.0.1" INTEL_DLINK.version = "0.0.2"
--- Function to instantiate a new object --- Function to instantiate a new object
-- @param #INTEL_DLINK self -- @param #INTEL_DLINK self
@ -2385,7 +2385,7 @@ function INTEL_DLINK:New(Intels, Alias, Interval, Cachetime)
end end
-- Cache time -- Cache time
self.cachetime = Cachetime or 300 self:SetDLinkCacheTime(Cachetime or 120)
-- Interval -- Interval
self.interval = Interval or 20 self.interval = Interval or 20
@ -2477,6 +2477,16 @@ function INTEL_DLINK:onafterStart(From, Event, To)
return self return self
end end
--- Function to set how long INTEL DLINK remembers contacts.
-- @param #INTEL_DLINK self
-- @param #number seconds Remember this many seconds. Defaults to 180.
-- @return #INTEL_DLINK self
function INTEL_DLINK:SetDLinkCacheTime(seconds)
self.cachetime = math.abs(seconds or 120)
self:I(self.lid.."Caching for "..self.cachetime.." seconds.")
return self
end
--- Function to collect data from the various #INTEL --- Function to collect data from the various #INTEL
-- @param #INTEL_DLINK self -- @param #INTEL_DLINK self
-- @param #string From The From state -- @param #string From The From state