import type { CacheableItemInterface } from '../types/index.js'; import type { CacheabilityInterface } from './CacheabilityInterface.js'; import { type MaxAge } from './maxAge.js'; type NumericKeys = { [K in keyof T]: T[K] extends number | null ? K : never; }[keyof T]; export declare class CacheHelper implements CacheabilityInterface { private readonly now; /** * The collected cache tags. */ tags: string[]; /** * Indicates if it should be cacheable. */ cacheable: boolean | null; /** * The maximum age. */ maxAge: number; /** * The stale if error age. */ staleIfError: number | null; constructor(now: number); /** * Set a numeric property, but **only** when the new value is * lower than the existing one (or the property is still `null`). * * `property` is restricted to *numeric* properties of **whatever * concrete class `this` is*. That includes fields that subclasses * add later. */ setNumeric>(property: K, providedValue: MaxAge): this; /** * Set the max age in seconds. * * The value is only set if it's smaller than the current max age or if it * hasn't been set yet. The initial value is `null`. * * You can always directly set the maxAge property on this object. */ setMaxAge(v: MaxAge): this; /** * Set the staleIfError in seconds. * * If set, then a stale version of the component may be returned if an error happens during rendering. */ setStaleIfError(v: MaxAge): this; /** * Add cache tags for this route. */ addTags(tags?: string[] | string): this; /** * Mark this item as cacheable. * * The initial value is null and this method only changes the value if it is * null. This means that once it's set to uncacheable, there is no way to * change it back. */ setCacheable(): this; /** * Mark the item as uncacheable. * * After that there is no way to make it cacheable again. */ setUncacheable(): this; /** * Get the expire timestamp as unix epoch (seconds). */ getExpires>(property: K): number | undefined; /** * Whether the item is cacheable. */ isCacheable(): boolean; mergeFromCacheItem(item: CacheableItemInterface): this; getMaxAge(): number; getStaleIfError(): number | null; getTags(): string[]; mergeFromCacheability(cacheability: CacheabilityInterface): this; } export {};