import { TypedFn } from '../internals/types.js'; import '../internals/helpers/guards.js'; /** * Copyright 2025 IBM Corp. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ type Instance = NonNullable; type CacheKeyFn = (this: Instance, ...args: any[]) => string; interface CacheDecoratorOptions { enabled: boolean; ttl?: number; cacheKey: CacheKeyFn; enumerable?: boolean; } interface CacheEntry { expiresAt: number; data: any; } interface CacheDecoratorInstance { get(key?: string): CacheEntry | undefined; clear(keys?: string[]): void; isEnabled(): boolean; enable(): void; disable(): void; update(data: Partial): void; } declare function Cache(_options?: Partial): (obj: NonNullable, key: string | symbol, descriptor: PropertyDescriptor) => void; declare namespace Cache { var init: >(self: T) => void; var getInstance: >(target: T, property: keyof T) => CacheDecoratorInstance; } declare const WeakRefKeyFn: { (...args: any[]): string; from(cb: (self: T) => any[]): (this: T) => string; }; declare const ObjectHashKeyFn: CacheKeyFn; declare const JSONCacheKeyFn: CacheKeyFn; declare const SingletonCacheKeyFn: CacheKeyFn; declare class CacheFn

extends Function { protected readonly fn: (...args: P) => R; protected readonly options?: Partial | undefined; readonly name: string; static create(fn: (...args: A) => B, options?: Partial): TypedFn & CacheFn; constructor(fn: (...args: P) => R, options?: Partial | undefined); updateTTL(ttl: number): void; createSnapshot(): { fn: (...args: P) => R; options: Partial | undefined; }; get(...args: P): R; } export { Cache, type CacheDecoratorInstance, type CacheDecoratorOptions, CacheFn, JSONCacheKeyFn, ObjectHashKeyFn, SingletonCacheKeyFn, WeakRefKeyFn };