@rb2bv/cache-handler
Version:
Next.js self-hosting simplified.
39 lines (36 loc) • 1.57 kB
text/typescript
import { Handler } from '../cache-handler.cjs';
import { C as CreateRedisStringsHandlerOptions } from '../common-types-D3MDcEyB.cjs';
import '../next-common-D8C6ukdH.cjs';
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 strings.
*
* 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 Handler. See {@link CreateRedisStringsHandlerOptions}.
*
* @returns An object representing the cache, with methods for cache operations.
*
* @example
* ```js
* const client = createClient(clientOptions);
*
* const redisHandler = await createHandler({
* client,
* keyPrefix: 'myApp:',
* sharedTagsKey: 'myTags'
* });
* ```
*
* @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, sharedTagsKey, timeoutMs, keyExpirationStrategy, revalidateTagQuerySize, }: CreateRedisStringsHandlerOptions): Handler;
export { CreateRedisStringsHandlerOptions, createHandler as default };