okhttp / okhttp3 / CacheControl / Builder / maxAge

maxAge

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

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