Class PolicyCache
java.lang.Object
de.fraunhofer.iese.mydata.pmp.cache.PolicyCache
- All Implemented Interfaces:
IPolicyCache
Keeps a copy of a policy list
- Author:
- feth
-
Constructor Summary
ConstructorsConstructorDescriptionPolicyCache(Supplier<Instant> instantSupplier, String cachePath, Duration maxCacheAge) -
Method Summary
Modifier and TypeMethodDescriptionvoidinvalidates the cachebooleanisValid()booleanupdateCache(Set<Policy> policies) updates cache content and refreshes validation timevoidvalidate()refreshes validation time of the cache without changing its contents
-
Constructor Details
-
PolicyCache
public PolicyCache() -
PolicyCache
-
-
Method Details
-
getPolicies
- Specified by:
getPoliciesin interfaceIPolicyCache- Returns:
- the cached policies if cache is valid or else empty Optional
-
isValid
public boolean isValid()- Specified by:
isValidin interfaceIPolicyCache- Returns:
- whether the cache is valid
-
invalidate
public void invalidate()Description copied from interface:IPolicyCacheinvalidates the cache- Specified by:
invalidatein interfaceIPolicyCache
-
validate
public void validate()Description copied from interface:IPolicyCacherefreshes validation time of the cache without changing its contents- Specified by:
validatein interfaceIPolicyCache
-
updateCache
Description copied from interface:IPolicyCacheupdates cache content and refreshes validation time- Specified by:
updateCachein interfaceIPolicyCache- Returns:
- whether updating the cache succeeded
-