UNPKG

772 BTypeScriptView Raw
1import type { Temporal } from 'temporal-spec';
2import type { Awaitable } from "./utils/common-types.js";
3import type { Context } from "./index.js";
4import { CacheControl } from '@tusbar/cache-control';
5/**
6 * The Cache-Control HTTP header field holds directives (instructions)
7 * — in both requests and responses — that control caching in browsers
8 * and shared caches (e.g. Proxies, CDNs).
9 *
10 * @link https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cache-Control
11 */
12export declare type CacheOptions = {
13 [K in keyof CacheControl]: CacheControl[K] extends (number | null | undefined) ? number | Temporal.Duration | null : CacheControl[K];
14};
15export declare const caching: (options?: CacheOptions) => <X extends Context>(ax: Awaitable<X>) => Promise<X>;