Class CacheControl
java.lang.Object
com.github.mizosoft.methanol.CacheControl
A group of
cache directives.
CacheControl provides type-safe accessors for the directives specified in RFC 7234. Additionally, there's
support for the stale-while-revalidate & stale-if-error extensions
specified in RFC 5861. Other
Cache-Control extensions can be accessed using the directives() map.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classA builder ofCacheControlinstances, with explicit directive setters for request cache directives. -
Method Summary
Modifier and TypeMethodDescriptionbooleanReturns whether themax-staledirective is present but has no value, which indicates that a response with any staleness is acceptable.Returns a map of all directives and their arguments.static CacheControlempty()Returns aCacheControlwith no directives.booleaninthashCode()booleanReturnstrueif theprivatedirective is set.booleanisPublic()Returnstrueif thepublicdirective is set.maxAge()Returns the value of themax-agedirective if present.maxStale()Returns the value of themax-staledirective if present.minFresh()Returns the value of themin-freshdirective if present.booleanReturnstrueif themust-revalidatedirective is set.static CacheControl.BuilderReturns a newBuilder.booleannoCache()Returnstrueif theno-cachedirective is set.Returns the header fields nominated byno-cacheif specified.booleannoStore()Returnstrueif theno-storedirective is set.Returns the header fields nominated byno-storeif specified.booleanReturnstrueif theno-transformdirective is set.booleanReturnstrueif theonly-if-cacheddirective is set.static CacheControlParses the cache directives specified by the given value.static CacheControlparse(HttpHeaders headers) Parses the cache directives specified by the given headers.static CacheControlParses the cache directives specified by each of the given values.Returns the header fields nominated byprivateif specified.booleanReturnstrueif theproxy-revalidatedirective is set.sMaxAge()Returns the value of thes-maxagedirective if present.Returns the value of thestale-if-errordirective if present.Returns the value of thestale-while-revalidatedirective if present.toString()
-
Method Details
-
directives
-
maxAge
-
sMaxAge
-
minFresh
-
maxStale
-
anyMaxStale
public boolean anyMaxStale()Returns whether themax-staledirective is present but has no value, which indicates that a response with any staleness is acceptable. -
staleWhileRevalidate
-
staleIfError
-
noCache
public boolean noCache()Returnstrueif theno-cachedirective is set. -
noCacheFields
-
noStore
public boolean noStore()Returnstrueif theno-storedirective is set. -
noStoreFields
-
noTransform
public boolean noTransform()Returnstrueif theno-transformdirective is set. -
isPublic
public boolean isPublic()Returnstrueif thepublicdirective is set. -
isPrivate
public boolean isPrivate()Returnstrueif theprivatedirective is set. -
privateFields
-
onlyIfCached
public boolean onlyIfCached()Returnstrueif theonly-if-cacheddirective is set. -
mustRevalidate
public boolean mustRevalidate()Returnstrueif themust-revalidatedirective is set. -
proxyRevalidate
public boolean proxyRevalidate()Returnstrueif theproxy-revalidatedirective is set. -
equals
-
hashCode
-
toString
-
parse
Parses the cache directives specified by the given value.- Throws:
IllegalArgumentException- if the given value has invalid cache directives
-
parse
Parses the cache directives specified by each of the given values.- Throws:
IllegalArgumentException- if any of the given values has invalid cache directives
-
parse
Parses the cache directives specified by the given headers.- Throws:
IllegalArgumentException- if the given headers have any invalid cache directives
-
newBuilder
Returns a newBuilder. -
empty
Returns aCacheControlwith no directives.
-