UNPKG

next

Version:

The React Framework

42 lines (41 loc) 1.69 kB
import type { CacheEntry } from '../lib/cache-handlers/types'; import { type SearchParams } from '../request/search-params'; import type { Params } from '../request/params'; export interface UseCachePageProps { params: Promise<Params>; searchParams: Promise<SearchParams>; $$isPage: true; } export type UseCacheLayoutProps = { params: Promise<Params>; $$isLayout: true; } & { [slot: string]: any; }; export interface CollectedCacheResult { entry: CacheEntry; /** * Whether the revalidate value was explicitly set via `cacheLife()`. * - `true`: explicitly set * - `false`: implicit (propagated from a nested cache or implicitly using the * default profile) * - `undefined`: unknown (e.g. pre-existing entry from a cache handler) */ hasExplicitRevalidate: boolean | undefined; /** * Whether the expire value was explicitly set via `cacheLife()`. * - `true`: explicitly set * - `false`: implicit (propagated from a nested cache or implicitly using the * default profile) * - `undefined`: unknown (e.g. pre-existing entry from a cache handler) */ hasExplicitExpire: boolean | undefined; /** * The root param names that were read during cache entry generation. * Used to compute the specific cache key after generation completes. * `undefined` for pre-existing entries from cache handlers where we * don't have this information. */ readRootParamNames: ReadonlySet<string> | undefined; } export declare function cache(kind: string, id: string, boundArgsLength: number, originalFn: (...args: unknown[]) => Promise<unknown>, args: unknown[]): Promise<unknown>;