import type { FastifyPluginCallback, FastifyRequest, preHandlerHookHandler } from 'fastify'; import type { Memorize } from '../domain/Memorize'; export interface FastifyAdapterOptions { /** Time-to-live in milliseconds. Defaults to the global TTL. */ ttl?: number; /** Skip caching for this route. Sets `X-Cache: BYPASS`. */ noCache?: boolean; /** Custom cache key extractor. Defaults to `request.url`. */ key?: (request: FastifyRequest) => string; /** Invalidation tags attached to every cached entry. See `deleteByTag`. */ tags?: string[]; } /** * Creates a Fastify plugin that caches `GET` route responses with a `2xx` * status code. * * Requires `fastify` to be installed as an optional peer dependency. * * @param cache - The {@link Memorize} instance to use as the backing store. * @param options - Optional plugin-level options. * * @example * ```ts * import Fastify from 'fastify'; * import { memorize } from 'express-memorize'; * import { createFastifyPlugin } from 'express-memorize/fastify'; * * const app = Fastify(); * const cache = memorize({ ttl: 30_000 }); * * await app.register(createFastifyPlugin(cache)); * ``` */ export declare function createFastifyPlugin(cache: Memorize, options?: FastifyAdapterOptions): FastifyPluginCallback; /** * Creates a route-level Fastify `preHandler` that caches `GET` responses. * * Use this when only selected routes should be cached, or when a route needs a * TTL, `noCache`, or key override. */ export declare function createFastifyPreHandler(cache: Memorize, options?: FastifyAdapterOptions): preHandlerHookHandler; //# sourceMappingURL=fastify.d.ts.map