cf-workers-query
Version:
Automatically cache and revalidate data in Cloudflare Workers. Using the Cache API and Execution Context
13 lines (10 loc) • 541 B
TypeScript
import { MiddlewareHandler, Handler, Context } from 'hono';
import { a as CreateQuery, Q as QueryKey } from '../create-query-BP--HoKq.js';
type CacheKey = QueryKey | ((ctx: Context) => QueryKey);
type CacheOptions = Omit<CreateQuery, 'queryKey' | 'queryFn' | 'executionCtx' | 'throwOnError' | 'revalidate'> & {
cacheKey: CacheKey;
handler: Handler;
revalidate?: boolean | ((ctx: Context) => boolean);
};
declare const cache: ({ cacheKey, handler, revalidate, ...options }: CacheOptions) => MiddlewareHandler;
export { cache };