UNPKG

@fly/cdn

Version:
31 lines (30 loc) 844 B
import { FetchFunction } from "../fetch"; /** * HTTP caching options. */ export interface HTTPCacheOptions { /** Overrides the cache TTL for all cacheable requests */ overrideMaxAge?: number; } /** * Cache HTTP responses with `cache-control` headers. * * Basic example: * ```typescript * import httpCache from "./src/middleware/http-cache"; * import backends from "./src/backends"; * * const glitch = backends.glitch("fly-example"); * * const origin = httpCache(glitch, { overrideMaxAge: 3600 }); * * fly.http.respondWith(origin); * ``` * * @param fetch * @param options */ export declare function httpCache(fetch: FetchFunction, options?: HTTPCacheOptions): FetchFunction; export declare namespace httpCache { var configure: (options?: HTTPCacheOptions | undefined) => (fetch: FetchFunction) => FetchFunction; }