/** * An index for tracking the most recently used contexts by timestamp with the ability to * update entry timestamps and prune out least used contexts above a max capacity provided. */ export default class ContextIndex { container: IndexContainer; /** * Creates a {@link ContextIndex} from its JSON representation (likely retrieved from persistence). * @param json representation of the {@link ContextIndex} * @returns the {@link ContextIndex} */ static fromJson(json: string): ContextIndex; /** * @returns the JSON representation of the {@link ContextIndex} (like for saving to persistence) */ toJson(): string; /** * Notice that a context has been used and when it was used. This will update an existing record * with the given timestamp, or create a new record if one doesn't exist. * @param id of the corresponding context * @param timestamp in millis since epoch */ notice(id: string, timestamp: number): void; /** * Prune the index to the specified max size and then return the IDs * @param maxContexts the maximum number of contexts to retain after this prune * @returns an array of removed entries */ prune(maxContexts: number): Array; } export interface IndexContainer { index: Array; } interface IndexEntry { id: string; timestamp: number; } export {}; //# sourceMappingURL=ContextIndex.d.ts.map