UNPKG

@fortedigital/nextjs-cache-handler

Version:
25 lines (22 loc) 1.28 kB
import { Handler } from './cache-handler.types.js'; import { CreateRedisStringsHandlerOptions } from './redis-strings.types.js'; import 'next/dist/server/lib/incremental-cache'; import 'next/dist/server/lib/incremental-cache/file-system-cache'; import '@redis/client'; /** * 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 and includes methods for on-demand revalidation of cache values. * * @param options - The configuration options for the Redis Handler. See {@link CreateRedisStringsHandlerOptions}. * * @returns An object representing the Redis-based cache handler, with methods for cache operations. * * @remarks * - The `get` method retrieves a value from the cache, automatically converting `Buffer` types when necessary. * - The `set` method stores a value in the cache, using the configured expiration strategy. * - The `revalidateTag` and `delete` methods handle cache revalidation and deletion. */ declare function createHandler({ client, keyPrefix, sharedTagsKey, sharedTagsTtlKey, timeoutMs, keyExpirationStrategy, revalidateTagQuerySize, }: CreateRedisStringsHandlerOptions): Handler; export { createHandler as default };