CacheControl

A Cache-Control header with cache directives from a server or client. These directives set policy on what responses can be stored, and which requests can be satisfied by those stored responses.

See RFC 7234, 5.2.

Types

Link copied to clipboard
class Builder

Builds a Cache-Control request header.

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
@get:JvmName(name = "immutable")
val immutable: Boolean
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
@get:JvmName(name = "maxAgeSeconds")
val maxAgeSeconds: Int

The duration past the response's served date that it can be served without validation.

Link copied to clipboard
@get:JvmName(name = "maxStaleSeconds")
val maxStaleSeconds: Int
Link copied to clipboard
@get:JvmName(name = "minFreshSeconds")
val minFreshSeconds: Int
Link copied to clipboard
@get:JvmName(name = "mustRevalidate")
val mustRevalidate: Boolean
Link copied to clipboard
@get:JvmName(name = "noCache")
val noCache: Boolean

In a response, this field's name "no-cache" is misleading. It doesn't prevent us from caching the response; it only means we have to validate the response with the origin server before returning it. We can do this with a conditional GET.

Link copied to clipboard
@get:JvmName(name = "noStore")
val noStore: Boolean

If true, this response should not be cached.

Link copied to clipboard
@get:JvmName(name = "noTransform")
val noTransform: Boolean
Link copied to clipboard
@get:JvmName(name = "onlyIfCached")
val onlyIfCached: Boolean

This field's name "only-if-cached" is misleading. It actually means "do not use the network". It is set by a client who only wants to make a request if it can be fully satisfied by the cache. Cached responses that would require validation (ie. conditional gets) are not permitted if this header is set.

Link copied to clipboard
@get:JvmName(name = "sMaxAgeSeconds")
val sMaxAgeSeconds: Int

The "s-maxage" directive is the max age for shared caches. Not to be confused with "max-age" for non-shared caches, As in Firefox and Chrome, this directive is not honored by this cache.

Functions

Link copied to clipboard
open override fun toString(): String