UNPKG

@next-boost/next-boost

Version:

Add a cache layer for next.js SSR pages. Use stale-while-revalidate to boost the performance.

12 lines (11 loc) 567 B
/// <reference types="node" /> import { ServerResponse } from 'http'; import { Cache, State } from './types'; export declare function hasLock(key: string, cache: Cache): Promise<boolean>; export declare function lock(key: string, cache: Cache): Promise<void>; export declare function unlock(key: string, cache: Cache): Promise<void>; export declare function serveCache(cache: Cache, key: string, forced: boolean): Promise<State>; export declare function send(payload: { body: Buffer | null; headers: Record<string, any> | null; }, res: ServerResponse): void;