Package org.forgerock.openig.tools
Class CachePolicyDecisionFilter
java.lang.Object
org.forgerock.openig.tools.NotSupportedFilter
org.forgerock.openig.tools.CachePolicyDecisionFilter
- All Implemented Interfaces:
AutoCloseable
,Filter
A CREST
Filter
that caches policy decisions.-
Constructor Summary
ConstructorsConstructorDescriptionCachePolicyDecisionFilter
(com.github.benmanes.caffeine.cache.Caffeine<Object, Object> caffeine, Clock clock, Duration defaultTimeout, Duration maximumTimeout, NotificationService notificationService, DisconnectionStrategy disconnectionStrategy) Builds aCachePolicyDecisionFilter
. -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
filterAction
(Context context, ActionRequest actionRequest, RequestHandler next) Filters an action request.Methods inherited from class org.forgerock.openig.tools.NotSupportedFilter
filterCreate, filterDelete, filterPatch, filterQuery, filterRead, filterUpdate
-
Constructor Details
-
CachePolicyDecisionFilter
public CachePolicyDecisionFilter(com.github.benmanes.caffeine.cache.Caffeine<Object, Object> caffeine, Clock clock, Duration defaultTimeout, Duration maximumTimeout, NotificationService notificationService, DisconnectionStrategy disconnectionStrategy) Builds aCachePolicyDecisionFilter
.- Parameters:
caffeine
- The caffeine cache to use. Notnull
.clock
- A clock providing access to the current instant, date and time using a time-zone, notnull
.defaultTimeout
- The default duration for which to cache AM policy decisions. If an AM policy decision provides a valid ttl value to specify the time until which the policy decision remains valid, IG uses that value or the maxTimeout.maximumTimeout
- The maximum duration for which to cache AM policy decisions. If the ttl value provided by the AM policy decision is after the current time plus the maxTimeout, IG uses the maxTimeout. Can benull
.notificationService
- The notification service used to connect on AM websocket notifications.disconnectionStrategy
- The strategy to apply in case of notifications' disconnection.- Throws:
NullPointerException
- If caffeine or clock arenull
.
-
-
Method Details
-
filterAction
public Promise<ActionResponse,ResourceException> filterAction(Context context, ActionRequest actionRequest, RequestHandler next) Description copied from interface:Filter
Filters an action request.- Specified by:
filterAction
in interfaceFilter
- Overrides:
filterAction
in classNotSupportedFilter
- Parameters:
context
- The filter chain context.actionRequest
- The action request.next
- A request handler representing the remainder of the filter chain.- Returns:
- A
Promise
containing the result of the operation.
-
close
public void close()- Specified by:
close
in interfaceAutoCloseable
-