/**
 * Document-Level Cache Middleware
 *
 * Caches full HTTP responses at the edge based on Cache-Control headers.
 * Routes opt-in to caching by setting s-maxage or stale-while-revalidate headers.
 *
 * Flow:
 * 1. Check cache for existing response
 * 2. If fresh hit → return cached response
 * 3. If stale hit (within SWR window) → return cached, revalidate in background
 * 4. If miss → run handler, cache if response has cache headers
 */
import type { MiddlewareFn, MiddlewareContext } from "../router/middleware.js";
export interface DocumentCacheOptions<TEnv = any> {
    /**
     * Skip caching for specific paths (e.g., API routes)
     */
    skipPaths?: string[];
    /**
     * Custom cache key generator
     */
    keyGenerator?: (url: URL) => string;
    /**
     * Callback to determine if caching should be enabled for this request.
     * Receives the middleware context and returns true to enable caching.
     * If not provided, caching is enabled by default.
     *
     * @example
     * ```typescript
     * createDocumentCacheMiddleware({
     *   isEnabled: (ctx) => !ctx.request.headers.has('x-skip-cache'),
     * })
     * ```
     */
    isEnabled?: (ctx: MiddlewareContext<TEnv>) => boolean | Promise<boolean>;
    /**
     * Enable debug logging for cache operations.
     * Logs HIT, MISS, STALE, and REVALIDATED events.
     * Defaults to false.
     */
    debug?: boolean;
}
/**
 * Create document cache middleware
 *
 * Add this middleware to your router to enable document-level caching.
 * It uses the cache store's getResponse/putResponse methods for caching.
 * Routes opt-in by setting Cache-Control headers with s-maxage.
 *
 * @example
 * ```typescript
 * // Add middleware to router
 * const router = createRouter<AppEnv>()
 *   .use(createDocumentCacheMiddleware({
 *     isEnabled: (ctx) => ctx.url.pathname !== '/admin',
 *   }))
 *   .route("home", (ctx) => {
 *     ctx.headers.set("Cache-Control", "s-maxage=60, stale-while-revalidate=300");
 *     return <HomePage />;
 *   });
 * ```
 */
export declare function createDocumentCacheMiddleware<TEnv = any>(options?: DocumentCacheOptions<TEnv>): MiddlewareFn<TEnv>;
//# sourceMappingURL=document-cache.d.ts.map