@nimpl/cache-adapter
Version:
An adapter that allows you to use any cache handler on the client and server side and switch between them. Adds support for running next.js applications in multiple instances.
36 lines (35 loc) • 865 B
TypeScript
export declare class RemoteCacheHandler {
/** next.js options */
options: any;
/** server url */
url: URL;
/**
* remote cache handler
* @param options next.js options
* @param url server url
* @param unique build id
*/
constructor(options: RemoteCacheHandler["options"], url: string, buildId: string);
/**
* get cache
* @param key cache key
* @returns cached data
*/
get(key: string): Promise<any>;
/**
* set cache
* @param key cache key
* @param data data to store
* @param ctx next.js context
*/
set(key: string, data: any, ctx: any): Promise<void>;
/**
* revalidate tag in cache
* @param tag cache tag
*/
revalidateTag(tag: string): Promise<void>;
/**
* revalidate tag in cache
*/
deleteOld(): Promise<void>;
}