import { type FastifyReply } from "fastify"; import { type CacheControlConfig } from "./types.js"; /** * 자주 사용하는 Cache-Control 프리셋입니다. * * @example * ```typescript * // API에서 사용 * @api({ * httpMethod: 'GET', * cacheControl: CachePresets.shortLived, * }) * * // SSR 라우트에서 사용 * registerSSR({ * path: '/products', * cacheControl: CachePresets.ssr, * }); * ``` */ export declare const CachePresets: { /** 캐시 금지 (민감한 데이터, mutation 요청) */ readonly noStore: { readonly noStore: true; }; /** 캐시하되 매번 재검증 */ readonly noCache: { readonly noCache: true; }; /** 짧은 캐시 (1분) - CSR fallback, 자주 변경되는 데이터에 적합 */ readonly shortLived: { readonly visibility: "public"; readonly maxAge: 60; }; /** SSR 캐시 (10초 + stale-while-revalidate 30초) */ readonly ssr: { readonly visibility: "public"; readonly maxAge: 10; readonly staleWhileRevalidate: 30; }; /** 중간 캐시 (5분) - 거의 변경되지 않는 데이터 (약관, 설정 등) */ readonly mediumLived: { readonly visibility: "public"; readonly maxAge: 300; }; /** 긴 캐시 (1시간) - 정적 컨텐츠 */ readonly longLived: { readonly visibility: "public"; readonly maxAge: 3600; }; /** 영구 캐시 (1년 + immutable) - 해시가 포함된 정적 파일 */ readonly immutable: { readonly visibility: "public"; readonly maxAge: 31536000; readonly immutable: true; }; /** 개인화된 데이터 (로그인 사용자별 다른 응답) */ readonly private: { readonly visibility: "private"; readonly noCache: true; }; }; /** * CacheControlConfig 객체를 HTTP Cache-Control 헤더 문자열로 변환합니다. * * @example * ```typescript * buildCacheControl({ visibility: 'public', maxAge: 60 }); * // => 'public, max-age=60' * * buildCacheControl({ noStore: true }); * // => 'no-store' * * buildCacheControl(CachePresets.immutable); * // => 'public, max-age=31536000, immutable' * ``` */ export declare function buildCacheControl(config: CacheControlConfig): string; /** * Cache-Control 헤더와 관련 헤더(Vary)를 FastifyReply에 설정합니다. * * @example * ```typescript * applyCacheHeaders(reply, { * visibility: "public", * maxAge: 300, * vary: ["Accept-Language"], * }); * // => Cache-Control: public, max-age=300 * // => Vary: Accept-Language * ``` */ export declare function applyCacheHeaders(reply: FastifyReply, config: CacheControlConfig): void; //# sourceMappingURL=cache-control.d.ts.map