Controlling cache headers

    This feature is defined in the class io.ktor.features.CachingHeaders and no additional artifacts are required.

    The options configuration method, allows you to define code to optionally select a CachingOptionsfrom a provided outgoingContent: OutgoingContent.You can, for example, use the of the outgoing message to determine which Cache-Control to use.

    1. data class CachingOptions(val cacheControl: CacheControl? = null, val expires: ZonedDateTime? = null)
    2. enum class Visibility { Public, Private }
    3. class NoCache(visibility: Visibility?) : CacheControl(visibility)
    4. class NoStore(visibility: Visibility?) : CacheControl(visibility)

    If you have several options, that would append several Cache-Control headers per each matching option.