类 CacheControl.Builder

java.lang.Object
com.lark.oapi.okhttp.CacheControl.Builder
封闭类:
CacheControl

public static final class CacheControl.Builder extends Object
Builds a Cache-Control request header.
  • 构造器详细资料

    • Builder

      public Builder()
  • 方法详细资料

    • noCache

      public CacheControl.Builder noCache()
      Don't accept an unvalidated cached response.
    • noStore

      public CacheControl.Builder noStore()
      Don't store the server's response in any cache.
    • maxAge

      public CacheControl.Builder maxAge(int maxAge, TimeUnit timeUnit)
      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.
      参数:
      maxAge - a non-negative integer. This is stored and transmitted with TimeUnit.SECONDS precision; finer precision will be lost.
    • maxStale

      public CacheControl.Builder maxStale(int maxStale, TimeUnit timeUnit)
      Accept cached responses that have exceeded their freshness lifetime by up to maxStale. If unspecified, stale cache responses will not be used.
      参数:
      maxStale - a non-negative integer. This is stored and transmitted with TimeUnit.SECONDS precision; finer precision will be lost.
    • minFresh

      public CacheControl.Builder minFresh(int minFresh, TimeUnit timeUnit)
      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.
      参数:
      minFresh - a non-negative integer. This is stored and transmitted with TimeUnit.SECONDS precision; finer precision will be lost.
    • onlyIfCached

      public CacheControl.Builder onlyIfCached()
      Only accept the response if it is in the cache. If the response isn't cached, a 504 Unsatisfiable Request response will be returned.
    • noTransform

      public CacheControl.Builder noTransform()
      Don't accept a transformed response.
    • immutable

      public CacheControl.Builder immutable()
    • build

      public CacheControl build()