Package io.micronaut.http.cachecontrol
Class CacheControl.Builder
java.lang.Object
io.micronaut.http.cachecontrol.CacheControl.Builder
- Enclosing class:
- CacheControl
Cache-Control Builder.
-
Method Summary
Modifier and TypeMethodDescriptionbuild()
Sets Cache-Control as inmmutable.Enables mustRevalidate.noCache()
noStore()
The private response directive indicates that the response can be stored only in a private cache (e.g.Enables proxyRevalidate.The public response directive indicates that the response can be stored in a shared cache.staleIfError
(@NonNull Long seconds) staleIfError
(@NonNull Duration staleIfError) staleWhileRevalidate
(@NonNull Long seconds) staleWhileRevalidate
(@NonNull Duration staleWhileRevalidate)
-
Method Details
-
proxyRevalidate
Enables proxyRevalidate. If cache is stale, it must revalidate with the proxy before use but only for shared caches.- Returns:
- The Cache-Control Builder.
-
mustRevalidate
Enables mustRevalidate. If cache is stale, it must revalidate with the server before use.- Returns:
- The Cache-Control Builder.
-
sMaxAge
- Parameters:
sMaxAge
- How long (in seconds) the response is considered fresh for shared (e.g., CDN) caches.- Returns:
- The Cache-Control Builder.
-
sMaxAge
- Parameters:
sMaxAge
- How long (in seconds) the response is considered fresh for shared (e.g., CDN) caches.- Returns:
- The Cache-Control Builder.
-
maxAge
- Parameters:
maxAge
- How long (in seconds) the response is considered fresh.- Returns:
- The Cache-Control Builder.
-
maxAge
- Parameters:
maxAge
- How long the response is considered fresh.- Returns:
- The Cache-Control Builder.
-
inmutable
Sets Cache-Control as inmmutable. It indicates the response won't change, so no revalidation is needed.- Returns:
- The Cache-Control Builder.
-
publicDirective
The public response directive indicates that the response can be stored in a shared cache.- Returns:
- The Cache-Control Builder.
-
privateDirective
The private response directive indicates that the response can be stored only in a private cache (e.g. local caches in browsers).- Returns:
- The Cache-Control Builder.
-
noStore
- Returns:
- The Cache-Control Builder.
-
noCache
- Returns:
- The Cache-Control Builder.
-
mustUnderstand
- Returns:
- The Cache-Control Builder.
-
noTransform
- Returns:
- The Cache-Control Builder.
-
staleWhileRevalidate
@NonNull public @NonNull CacheControl.Builder staleWhileRevalidate(@NonNull @NonNull Duration staleWhileRevalidate) - Parameters:
staleWhileRevalidate
- Stale while revalidate duration- Returns:
- The Cache-Control Builder.
-
staleWhileRevalidate
- Parameters:
seconds
- Stale while revalidate seconds- Returns:
- The Cache-Control Builder.
-
staleIfError
- Parameters:
staleIfError
- Stale if error duration- Returns:
- The Cache-Control Builder.
-
staleIfError
- Parameters:
seconds
- Stale if error seconds- Returns:
- The Cache-Control Builder.
-
build
- Returns:
- A Cache-Control
-