UNPKG

@dialog-db/query

Version:

Datalog query engine inspired by Datomic

48 lines 1.52 kB
export function identify({ the, of, is }: API.FactsSelector): string; export function create(source: API.Querier, { capacity }?: { capacity?: number | undefined; }): LRUCache; import * as API from '../api.js'; /** * Implements a Least Recently Used (LRU) cache for facts with a capacity limit * based on the total number of individual facts cached. */ declare class LRUCache { /** * @param {API.Querier} source - The underlying data source * @param {number} capacity - Maximum number of individual facts to store in cache */ constructor(source: API.Querier, capacity: number); source: API.Querier; capacity: number; /** @type {Map<string, API.Datum[]>} */ cache: Map<string, API.Datum[]>; /** * Updates the LRU order by removing and re-adding the key * @param {string} key */ touch(key: string): void; /** * Evicts entries until cache is under capacity */ evict(): void; /** * @param {API.FactsSelector} selector */ select(selector: API.FactsSelector): Generator<typeof import("../task.js").SUSPEND | import("../task.js").Join | import("../task.js").Throw<Error>, API.Datum<`${string}/${string}`, API.Entity, API.Scalar>[], unknown>; /** * Clears the cache */ clear(): void; /** * Returns current number of cached facts */ size(): number; /** * Returns the number of cached queries */ get count(): number; #private; } export {}; //# sourceMappingURL=lru.d.ts.map