@rb2bv/cache-handler
Version:
Next.js self-hosting simplified.
38 lines (35 loc) • 1.49 kB
TypeScript
import { Handler } from '../cache-handler.js';
import { a as CreateRedisStackHandlerOptions } from '../common-types-D3MDcEyB.js';
import '../next-common-D8C6ukdH.js';
import 'next/dist/server/lib/incremental-cache';
import 'next/dist/server/lib/incremental-cache/file-system-cache';
import 'next/dist/server/response-cache/types';
import 'redis';
/**
* Creates a Handler for handling cache operations using Redis JSON.
*
* This function initializes a Handler for managing cache operations using Redis.
* It supports Redis Client. The resulting Handler includes
* methods to get, set, and manage cache values fot on-demand revalidation.
*
* @param options - The configuration options for the Redis Stack Handler. See {@link CreateRedisStackHandlerOptions}.
*
* @returns An object representing the cache, with methods for cache operations.
*
* @example
* ```js
* const client = createClient(clientOptions);
*
* const redisHandler = createHandler({
* client,
* keyPrefix: 'myApp:',
* });
* ```
*
* @remarks
* - the `get` method retrieves a value from the cache, automatically converting `Buffer` types when necessary.
* - the `set` method allows setting a value in the cache.
* - the `revalidateTag` methods are used for handling tag-based cache revalidation.
*/
declare function createHandler({ client, keyPrefix, timeoutMs, revalidateTagQuerySize, }: CreateRedisStackHandlerOptions): Handler;
export { CreateRedisStackHandlerOptions, createHandler as default };