CacheControlValue
Cache control directive
struct CacheControlValue
Cache control directive
struct CacheControlValue
import Hummingbird
struct CacheControl
Associates cache control values with filename
init(_ entries: [(MediaType, [CacheControlValue])])
Initialize cache control
init(_ entries: [(MediaType, [Value])])
Initialize cache control
func getCacheControlHeader(for file: String) -> String?
Get the Cache-Control header for a file
enum Value
Cache control directive
protocol CustomStringConvertible
A type with a customized textual representation.
protocol Sendable
static var immutable: Self { get }
The immutable response directive indicates that the response will not be updated while it’s fresh.
static var mustRevalidate: Self { get }
The must-revalidate response directive indicates that the response can be stored in caches and can be reused while fresh. If the response becomes stale, it must be validated with the origin server before reuse.
static var mustUnderstand: Self { get }
The must-understand response directive indicates that a cache should store the response only if it understands the requirements for caching based on status code.
static var noCache: Self { get }
The no-cache response directive indicates that the response can be stored in caches, but the response must be validated with the origin server before each reuse, even when the cache is disconnected from the origin server.
static var noStore: Self { get }
The no-store response directive indicates that any caches of any kind (private or shared) should not store this response.
static var noTransform: Self { get }
Some intermediaries transform content for various reasons. For example, some convert images to reduce transfer size. In some cases, this is undesirable for the content provider.
static var `private`: Self { get }
The private response directive indicates that the response can be stored only in a private cache (e.g. local caches in browsers).
static var `public`: Self { get }
The public response directive indicates that the response can be stored in a shared cache. Responses for requests with Authorization header fields must not be stored in a shared cache; however, the public directive will cause such responses to be stored in a shared cache.
static func custom(_ string: String) -> CacheControl.CacheControlValue
Custom directive
static func maxAge(_ amount: Int) -> CacheControl.CacheControlValue
The max-age=N response directive indicates that the response remains fresh until N seconds after the response is generated.
var description: String { get }