Rebasely Beta: data may be purged

justintypescript-ultra-strict Public

TypeScript · 20 lines · 525 B · at 9dcde16

export class LruError extends Error {  constructor(public readonly kind: "invalid_capacity") {    super(kind);  }}export type Lru<V> = {  /** The stored value, or undefined when the key is missing. */  get(key: string): V | undefined;  set(key: string, value: V): void;  delete(key: string): boolean;  size(): number;  /** Most recently used first. */  keys(): string[];};/** Throws LruError when capacity is not a non-negative integer. */export function createLru<V>(capacity: number): Lru<V> {  // TODO}