Skip to content

//okhttp/okhttp3/CacheControl/Builder/maxAge

maxAge

[jvm]\ fun maxAge(maxAge: Int, timeUnit: TimeUnit): 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.

Parameters

jvm

maxAge a non-negative integer. This is stored and transmitted with TimeUnit.SECONDS precision; finer precision will be lost.

[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.

Parameters

common

maxAge a non-negative integer. This is stored and transmitted with TimeUnit.SECONDS precision; finer precision will be lost.

[jvm]\ actual fun maxAge(maxAge: Int, timeUnit: DurationUnit): CacheControl.Builder