/opt/canhelp/node_modules/next/dist/server/lib/incremental-cache
Edit: /opt/canhelp/node_modules/next/dist/server/lib/incremental-cache/index.d.ts (3851B)
import type { CacheFs } from '../../../shared/lib/utils';
import type { PrerenderManifest } from '../../../build';
import { type IncrementalCacheValue, type IncrementalCache as IncrementalCacheType, type IncrementalResponseCacheEntry, type IncrementalFetchCacheEntry, type GetIncrementalFetchCacheContext, type GetIncrementalResponseCacheContext, type CachedFetchValue, type SetIncrementalFetchCacheContext, type SetIncrementalResponseCacheContext } from '../../response-cache';
import type { DeepReadonly } from '../../../shared/lib/deep-readonly';
export interface CacheHandlerContext {
fs?: CacheFs;
dev?: boolean;
flushToDisk?: boolean;
serverDistDir?: string;
maxMemoryCacheSize?: number;
fetchCacheKeyPrefix?: string;
prerenderManifest?: PrerenderManifest;
revalidatedTags: string[];
_requestHeaders: IncrementalCache['requestHeaders'];
}
export interface CacheHandlerValue {
lastModified?: number;
age?: number;
cacheState?: string;
value: IncrementalCacheValue | null;
}
export declare class CacheHandler {
constructor(_ctx: CacheHandlerContext);
get(_cacheKey: string, _ctx: GetIncrementalFetchCacheContext | GetIncrementalResponseCacheContext): Promise
;
set(_cacheKey: string, _data: IncrementalCacheValue | null, _ctx: SetIncrementalFetchCacheContext | SetIncrementalResponseCacheContext): Promise;
revalidateTag(..._args: Parameters): Promise;
resetRequestCache(): void;
}
export declare class IncrementalCache implements IncrementalCacheType {
readonly dev?: boolean;
readonly disableForTestmode?: boolean;
readonly cacheHandler?: CacheHandler;
readonly hasCustomCacheHandler: boolean;
readonly prerenderManifest: DeepReadonly;
readonly requestHeaders: Record;
readonly allowedRevalidateHeaderKeys?: string[];
readonly minimalMode?: boolean;
readonly fetchCacheKeyPrefix?: string;
readonly revalidatedTags?: string[];
readonly isOnDemandRevalidate?: boolean;
private static readonly debug;
private readonly locks;
/**
* The cache controls for routes. This will source the values from the
* prerender manifest until the in-memory cache is updated with new values.
*/
private readonly cacheControls;
constructor({ fs, dev, flushToDisk, minimalMode, serverDistDir, requestHeaders, maxMemoryCacheSize, getPrerenderManifest, fetchCacheKeyPrefix, CurCacheHandler, allowedRevalidateHeaderKeys, }: {
fs?: CacheFs;
dev: boolean;
minimalMode?: boolean;
serverDistDir?: string;
flushToDisk?: boolean;
allowedRevalidateHeaderKeys?: string[];
requestHeaders: IncrementalCache['requestHeaders'];
maxMemoryCacheSize?: number;
getPrerenderManifest: () => DeepReadonly;
fetchCacheKeyPrefix?: string;
CurCacheHandler?: typeof CacheHandler;
});
private calculateRevalidate;
_getPathname(pathname: string, fetchCache?: boolean): string;
resetRequestCache(): void;
lock(cacheKey: string): Promise<() => Promise | void>;
revalidateTag(tags: string | string[]): Promise;
generateCacheKey(url: string, init?: RequestInit | Request): Promise;
get(cacheKey: string, ctx: GetIncrementalFetchCacheContext): Promise;
get(cacheKey: string, ctx: GetIncrementalResponseCacheContext): Promise;
set(pathname: string, data: CachedFetchValue | null, ctx: SetIncrementalFetchCacheContext): Promise;
set(pathname: string, data: Exclude | null, ctx: SetIncrementalResponseCacheContext): Promise;
}