import type { Cache } from "./types.ts"; /** How long an answer stays cached, when nobody says otherwise. */ export declare const DEFAULT_TTL_SECONDS: number; /** * The cache key for a question. * * The question is folded first, so "Is X banned?" and "is x banned" share one * entry. Two questions that fold together are served the same answer, which is * why the folding is conservative rather than clever. * * `version` scopes the whole cache. Bump it when the corpus changes and every * stale answer becomes unreachable at once, with no key to enumerate and delete. */ export declare function answerKey(question: string, version?: string): string; /** * A cache in this process's memory. * * The default, because it needs no account, no service, and no configuration. * One process gets the benefit; a second process starts cold. That is the right * default for a project somebody just cloned, and the wrong one for a fleet, so * a fork points `cache` at something shared. * * `maxEntries` bounds it. Without a bound a long-running process caches every * question ever asked and eventually runs out of memory, which is a worse * failure than a cache miss. */ export declare class MemoryCache implements Cache { #private; constructor(options?: { maxEntries?: number; }); get(key: string): Promise; set(key: string, value: T, ttlSeconds?: number): Promise; delete(key: string): Promise; clear(): Promise; /** How many entries are held. For tests and for a status page. */ get size(): number; } /** * A cache that survives a restart, in a SQLite file. * * Still no account and no service, and now a redeploy does not throw away every * answer already paid for. Use it wherever a writable file exists. */ export declare class SqliteCache implements Cache { #private; private constructor(); /** Open or create a cache file. Pass ":memory:" for a throwaway one. */ static open(path: string): Promise; get(key: string): Promise; set(key: string, value: T, ttlSeconds?: number): Promise; delete(key: string): Promise; clear(): Promise; /** Remove expired rows. Nothing requires this; it only reclaims disk. */ prune(): Promise; close(): void; } /** A cache that stores nothing. Useful in tests and when measuring cold cost. */ export declare class NoopCache implements Cache { get(): Promise; set(): Promise; delete(): Promise; clear(): Promise; } //# sourceMappingURL=cache.d.ts.map