UNPKG

cf-workers-query

Version:

Automatically cache and revalidate data in Cloudflare Workers. Using the Cache API and Execution Context

13 lines (10 loc) 542 B
import { MiddlewareHandler, Handler, Context } from 'hono'; import { a as CreateQuery, Q as QueryKey } from '../create-query-BP--HoKq.cjs'; 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 };