@Contract(threading=IMMUTABLE) public final class ResponseCacheControl extends Object implements CacheControl
The class provides methods to retrieve the maximum age of the response and the maximum age that applies to shared caches. The values are expressed in seconds, with -1 indicating that the value was not specified in the header.
Instances of this class are immutable, meaning that their values cannot be changed once they are set. To create an instance, use one of the constructors that take the desired values as arguments. Alternatively, use the default constructor to create an instance with both values set to -1, indicating that the header was not present in the response.
Modifier and Type | Class and Description |
---|---|
static class |
ResponseCacheControl.Builder |
Modifier and Type | Field and Description |
---|---|
static ResponseCacheControl |
DEFAULT |
Modifier and Type | Method and Description |
---|---|
static ResponseCacheControl.Builder |
builder() |
long |
getMaxAge()
Returns the max-age value from the Cache-Control header.
|
Set<String> |
getNoCacheFields()
Returns an unmodifiable set of field names specified in the "no-cache" directive of the Cache-Control header.
|
long |
getSharedMaxAge()
Returns the shared-max-age value from the Cache-Control header.
|
long |
getStaleIfError()
Returns the stale-if-error value from the Cache-Control header.
|
long |
getStaleWhileRevalidate()
Returns the stale-while-revalidate value from the Cache-Control header.
|
boolean |
isCachePrivate()
Returns the private flag from the Cache-Control header.
|
boolean |
isImmutable()
Returns the 'immutable' Cache-Control directive status.
|
boolean |
isMustRevalidate()
Returns whether the must-revalidate directive is present in the Cache-Control header.
|
boolean |
isMustUnderstand()
Returns the must-understand directive from the Cache-Control header.
|
boolean |
isNoCache()
Returns the no-cache flag from the Cache-Control header.
|
boolean |
isNoStore()
Returns the no-store flag from the Cache-Control header.
|
boolean |
isProxyRevalidate()
Returns whether the proxy-revalidate value is set in the Cache-Control header.
|
boolean |
isPublic()
Returns whether the public value is set in the Cache-Control header.
|
boolean |
isUndefined()
Returns the 'immutable' Cache-Control directive status.
|
String |
toString() |
public static final ResponseCacheControl DEFAULT
public long getMaxAge()
getMaxAge
in interface CacheControl
public long getSharedMaxAge()
public boolean isNoCache()
isNoCache
in interface CacheControl
public boolean isNoStore()
isNoStore
in interface CacheControl
public boolean isCachePrivate()
public boolean isMustUnderstand()
public boolean isMustRevalidate()
true
if the must-revalidate directive is present, otherwise false
public boolean isProxyRevalidate()
true
if proxy-revalidate is set, false
otherwise.public boolean isPublic()
true
if public is set, false
otherwise.public long getStaleWhileRevalidate()
public long getStaleIfError()
getStaleIfError
in interface CacheControl
public Set<String> getNoCacheFields()
public boolean isUndefined()
public boolean isImmutable()
public static ResponseCacheControl.Builder builder()
Copyright © 2010–2021 The Apache Software Foundation. All rights reserved.