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 TypeMethodDescription@NonNull CacheControlbuild()@NonNull CacheControl.BuilderSets Cache-Control as inmmutable.@NonNull CacheControl.Builder@NonNull CacheControl.Builder@NonNull CacheControl.BuilderEnables mustRevalidate.@NonNull CacheControl.Builder@NonNull CacheControl.BuildernoCache()@NonNull CacheControl.BuildernoStore()@NonNull CacheControl.Builder@NonNull CacheControl.BuilderThe private response directive indicates that the response can be stored only in a private cache (e.g.@NonNull CacheControl.BuilderEnables proxyRevalidate.@NonNull CacheControl.BuilderThe public response directive indicates that the response can be stored in a shared cache.@NonNull CacheControl.Builder@NonNull CacheControl.Builder@NonNull CacheControl.BuilderstaleIfError(@NonNull Long seconds) @NonNull CacheControl.BuilderstaleIfError(@NonNull Duration staleIfError) @NonNull CacheControl.BuilderstaleWhileRevalidate(@NonNull Long seconds) @NonNull CacheControl.BuilderstaleWhileRevalidate(@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
- 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
-