nuxt-multi-cache
Version:
SSR route, component and data cache for Nuxt.js
26 lines (25 loc) • 1.21 kB
TypeScript
/// <reference types="node" />
import type { ComponentCacheItem, RouteCacheItem } from '../types.js';
/**
* Encode the data of the route cache in a string.
*/
export declare function encodeRouteCacheItem(data: string, headers: Record<string, any>, statusCode: number, expires: number | undefined, staleIfErrorExpires: number | undefined, staleWhileRevalidate: boolean | undefined, cacheTags: string[]): string;
/**
* Decode the encoded route cache string item.
*/
export declare function decodeRouteCacheItem(cacheItem: string): RouteCacheItem | undefined;
/**
* Encode the component cache data.
*/
export declare function encodeComponentCacheItem(data: string, payload?: Record<string, any>, expires?: number | undefined, cacheTags?: string[]): string;
/**
* Decode the encoded component cache string item.
*/
export declare function decodeComponentCacheItem(cacheItem: string): ComponentCacheItem | undefined;
/**
* Handle the return value from cache.getItemRaw().
*
* Not all drivers return strings, so this method handles the case where a
* driver returns other types such as buffers.
*/
export declare function handleRawCacheData(data: string | Buffer | undefined | null): string | undefined;