Skip to content

//okhttp/okhttp3/CacheControl/Builder

Builder

[common]\ expect class Builder

Builds a Cache-Control request header.

[jvm, nonJvm]\ actual class Builder

Constructors

Builder [jvm, nonJvm]
fun Builder()
[common]
expect fun Builder()

Functions

Name Summary
build [common, jvm, nonJvm]
[common]
expect fun build(): CacheControl
[jvm, nonJvm]
actual fun build(): CacheControl
immutable [common, jvm, nonJvm]
[common]
expect fun immutable(): CacheControl.Builder
[jvm, nonJvm]
actual fun immutable(): CacheControl.Builder
maxAge [jvm, common]
[jvm]
fun maxAge(maxAge: Int, timeUnit: TimeUnit): CacheControl.Builder
[common]
expect fun maxAge(maxAge: Int, timeUnit: DurationUnit): CacheControl.Builder
Sets the maximum age of a cached response. If the cache response’s age exceeds maxAge, it will not be used and a network request will be made.
[jvm]
actual fun maxAge(maxAge: Int, timeUnit: DurationUnit): CacheControl.Builder
maxStale [jvm, common]
[jvm]
fun maxStale(maxStale: Int, timeUnit: TimeUnit): CacheControl.Builder
[common]
expect fun maxStale(maxStale: Int, timeUnit: DurationUnit): CacheControl.Builder
Accept cached responses that have exceeded their freshness lifetime by up to maxStale. If unspecified, stale cache responses will not be used.
[jvm]
actual fun maxStale(maxStale: Int, timeUnit: DurationUnit): CacheControl.Builder
minFresh [jvm, common]
[jvm]
fun minFresh(minFresh: Int, timeUnit: TimeUnit): CacheControl.Builder
[common]
expect fun minFresh(minFresh: Int, timeUnit: DurationUnit): CacheControl.Builder
Sets the minimum number of seconds that a response will continue to be fresh for. If the response will be stale when minFresh have elapsed, the cached response will not be used and a network request will be made.
[jvm]
actual fun minFresh(minFresh: Int, timeUnit: DurationUnit): CacheControl.Builder
noCache [common]
expect fun noCache(): CacheControl.Builder
Don’t accept an unvalidated cached response.
[jvm, nonJvm]
[jvm, nonJvm]
actual fun noCache(): CacheControl.Builder
noStore [common]
expect fun noStore(): CacheControl.Builder
Don’t store the server’s response in any cache.
[jvm, nonJvm]
[jvm, nonJvm]
actual fun noStore(): CacheControl.Builder
noTransform [common]
expect fun noTransform(): CacheControl.Builder
Don’t accept a transformed response.
[jvm, nonJvm]
[jvm, nonJvm]
actual fun noTransform(): CacheControl.Builder
onlyIfCached [common]
expect fun onlyIfCached(): CacheControl.Builder
Only accept the response if it is in the cache. If the response isn’t cached, a 504 Unsatisfiable Request response will be returned.
[jvm, nonJvm]
[jvm, nonJvm]
actual fun onlyIfCached(): CacheControl.Builder