Class TimerCache
- java.lang.Object
-
- de.fraunhofer.iese.mydata.pmp.cache.TimerCache
-
- All Implemented Interfaces:
ITimerCache
public class TimerCache extends Object implements ITimerCache
Keeps a copy of a timer list- Author:
- kelbert
-
-
Constructor Summary
Constructors Constructor Description TimerCache()TimerCache(java.util.function.Supplier<java.time.Instant> instantSupplier, String cachePath, java.time.Duration maxCacheAge)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Optional<Set<de.fraunhofer.iese.mydata.timer.Timer>>getTimers()voidinvalidate()invalidates the cachebooleanisValid()booleanupdateCache(Set<de.fraunhofer.iese.mydata.timer.Timer> policies)updates cache content and refreshes validation timevoidvalidate()refreshes validation time of the cache without changing its contents
-
-
-
Constructor Detail
-
TimerCache
public TimerCache()
-
TimerCache
public TimerCache(java.util.function.Supplier<java.time.Instant> instantSupplier, String cachePath, @Nullable java.time.Duration maxCacheAge)
-
-
Method Detail
-
getTimers
public Optional<Set<de.fraunhofer.iese.mydata.timer.Timer>> getTimers()
- Specified by:
getTimersin interfaceITimerCache- Returns:
- the cached timers if cache is valid or else empty Optional
-
isValid
public boolean isValid()
- Specified by:
isValidin interfaceITimerCache- Returns:
- whether the cache is valid
-
invalidate
public void invalidate()
Description copied from interface:ITimerCacheinvalidates the cache- Specified by:
invalidatein interfaceITimerCache
-
validate
public void validate()
Description copied from interface:ITimerCacherefreshes validation time of the cache without changing its contents- Specified by:
validatein interfaceITimerCache
-
updateCache
public boolean updateCache(Set<de.fraunhofer.iese.mydata.timer.Timer> policies)
Description copied from interface:ITimerCacheupdates cache content and refreshes validation time- Specified by:
updateCachein interfaceITimerCache- Returns:
- whether updating the cache succeeded
-
-