diff --git a/src/runtime/internal/cache.ts b/src/runtime/internal/cache.ts index f2dc00c7e2..56b4251d41 100644 --- a/src/runtime/internal/cache.ts +++ b/src/runtime/internal/cache.ts @@ -32,7 +32,7 @@ function defaultCacheOptions() { export function defineCachedFunction( fn: (...args: ArgsT) => T | Promise, - opts: CacheOptions = {} + opts: CacheOptions = {} ): (...args: ArgsT) => Promise { opts = { ...defaultCacheOptions(), ...opts }; diff --git a/src/types/runtime/cache.ts b/src/types/runtime/cache.ts index add9ea7ac5..5cc6b39a82 100644 --- a/src/types/runtime/cache.ts +++ b/src/types/runtime/cache.ts @@ -7,13 +7,13 @@ export interface CacheEntry { integrity?: string; } -export interface CacheOptions { +export interface CacheOptions { name?: string; - getKey?: (...args: any[]) => string | Promise; - transform?: (entry: CacheEntry, ...args: any[]) => any; - validate?: (entry: CacheEntry) => boolean; - shouldInvalidateCache?: (...args: any[]) => boolean | Promise; - shouldBypassCache?: (...args: any[]) => boolean | Promise; + getKey?: (...args: ArgsT) => string | Promise; + transform?: (entry: CacheEntry, ...args: ArgsT) => any; + validate?: (entry: CacheEntry, ...args: ArgsT) => boolean; + shouldInvalidateCache?: (...args: ArgsT) => boolean | Promise; + shouldBypassCache?: (...args: ArgsT) => boolean | Promise; group?: string; integrity?: any; /** @@ -32,10 +32,10 @@ export interface ResponseCacheEntry { } export interface CachedEventHandlerOptions - extends Omit>, "transform" | "validate"> { - shouldInvalidateCache?: (event: H3Event) => boolean | Promise; - shouldBypassCache?: (event: H3Event) => boolean | Promise; - getKey?: (event: H3Event) => string | Promise; + extends Omit< + CacheOptions, [H3Event]>, + "transform" | "validate" + > { headersOnly?: boolean; varies?: string[] | readonly string[]; }