Package org.forgerock.json.resource
Class ResponseCacheControl
java.lang.Object
org.forgerock.json.resource.ResponseCacheControl
Indicates whether a response can be cached and under what conditions.
-
Method Summary
Modifier and TypeMethodDescriptionstatic ResponseCacheControlIndicates that clients and proxies should never cache the response under any circumstances.static ResponseCacheControlReturns a cache control that will allow caching until the given maximum age.static ResponseCacheControlforMaxAgeSeconds(long maxAge) Returns a cache control that will allow caching until the given maximum age (in seconds).longThe maximum age (in seconds) that the response should be cached.booleanIndicates whether the response should ever be cached.static ResponseCacheControlReturns a cache control that will allow caching until the given deadline according to the given clock.
-
Method Details
-
forMaxAgeSeconds
Returns a cache control that will allow caching until the given maximum age (in seconds).- Parameters:
maxAge- the maximum age that the response can be cached for (in seconds).- Returns:
- the cache control.
-
forMaxAge
Returns a cache control that will allow caching until the given maximum age.- Parameters:
maxAge- the maximum age that the response can be cached for.- Returns:
- the cache control.
-
until
Returns a cache control that will allow caching until the given deadline according to the given clock.- Parameters:
deadline- the deadline at which to consider the response to be stale.clock- the clock to use to determine the time until the deadline.- Returns:
- the cache control.
-
disableCaching
Indicates that clients and proxies should never cache the response under any circumstances.- Returns:
- a cache control that disables caching.
-
isCacheable
public boolean isCacheable()Indicates whether the response should ever be cached.- Returns:
trueif the response can be cached orfalseto disable all caching.
-
getMaxAgeSeconds
public long getMaxAgeSeconds()The maximum age (in seconds) that the response should be cached. After this time has expired the client or proxy should re-fetch the resource from the server.- Returns:
- the maximum length of time in seconds to cache a response for.
-