CacheControlCacheStrategy

class CacheControlCacheStrategy @JvmOverloads constructor(now: () -> Instant = Clock.System::now) : CacheStrategy

A CacheStrategy that uses the 'Cache-Control' response header and associated headers to determine if a cached response should be used.

See: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cache-Control

This implementation is based on OkHttp's CacheStrategy.

Parameters

now

A function that returns the current time.

Constructors

Link copied to clipboard
constructor(now: () -> Instant = Clock.System::now)

Functions

Link copied to clipboard
open suspend override fun read(cacheResponse: NetworkResponse, networkRequest: NetworkRequest, options: Options): CacheStrategy.ReadResult
Link copied to clipboard
open suspend override fun write(cacheResponse: NetworkResponse?, networkRequest: NetworkRequest, networkResponse: NetworkResponse, options: Options): CacheStrategy.WriteResult