index.d.ts 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. import type { CacheFs } from '../../../shared/lib/utils';
  2. import { PrerenderManifest } from '../../../build';
  3. import { IncrementalCacheValue, IncrementalCacheEntry } from '../../response-cache';
  4. export interface CacheHandlerContext {
  5. fs: CacheFs;
  6. dev?: boolean;
  7. flushToDisk?: boolean;
  8. serverDistDir: string;
  9. maxMemoryCacheSize?: number;
  10. _appDir?: boolean;
  11. }
  12. export interface CacheHandlerValue {
  13. lastModified?: number;
  14. value: IncrementalCacheValue | null;
  15. }
  16. export declare class CacheHandler {
  17. constructor(_ctx: CacheHandlerContext);
  18. get(_key: string): Promise<CacheHandlerValue | null>;
  19. set(_key: string, _data: IncrementalCacheValue | null): Promise<void>;
  20. }
  21. export declare class IncrementalCache {
  22. dev?: boolean;
  23. cacheHandler: CacheHandler;
  24. prerenderManifest: PrerenderManifest;
  25. constructor({ fs, dev, appDir, flushToDisk, serverDistDir, maxMemoryCacheSize, getPrerenderManifest, incrementalCacheHandlerPath, }: {
  26. fs: CacheFs;
  27. dev: boolean;
  28. appDir?: boolean;
  29. serverDistDir: string;
  30. flushToDisk?: boolean;
  31. maxMemoryCacheSize?: number;
  32. incrementalCacheHandlerPath?: string;
  33. getPrerenderManifest: () => PrerenderManifest;
  34. });
  35. private calculateRevalidate;
  36. _getPathname(pathname: string): string;
  37. get(pathname: string): Promise<IncrementalCacheEntry | null>;
  38. set(pathname: string, data: IncrementalCacheValue | null, revalidateSeconds?: number | false): Promise<void>;
  39. }