/** * Simple cache by ID. */ export default class SimpleMemoization { private readonly cache_; private readonly cachePassthrough_; /** * Construct this, with an optional cache passthrough method. Use this * to add idempotency to memoized objects where needed, such as cloning them * or locking them. * * @param cachePassthrough A function that is called to transform or clone * a memoized object when it is added. */ constructor(cachePassthrough?: (from: T) => T); /** * Get the number of memoized items * * @return {number} The number of items memoized in this. */ get length(): number; /** * Iterate through the cached objects * * @return {IterableIterator<[ number, T ]>} Iterate over this. */ [Symbol.iterator](): IterableIterator<[number, T]>; /** * Add an item to the cache. * * @param id * @param value * @param temporary */ add(id: number, value: T, temporary?: boolean): void; /** * Delete an item from the cache. * * @param id * @return {boolean} True if the item was in the cache. */ delete(id: number): boolean; /** * Get the cached item for a particular id. * * @param id * @return {T | undefined} */ get(id: number): T | undefined; /** * Clear the cache */ clear(): void; } //# sourceMappingURL=simple_memoization.d.ts.map