Constructors
constructor
- new LruSet<T>(capacity: number, SetImpl?: new () => Set<T>): LruSet<T>
Parameters
- capacity: number
- SetImpl: new () => Set<T> = Set
Methods
add
- add(val: T): void
Returns void
clear
- clear(): void
Returns void
has
- has(val: T): boolean
Returns boolean
Simple class implementing LRU-like behaviour for a Set.
Note: this is not exactly LRU, but rather "least recently added" and doesn't mark items as recently added if they are already in the set.
Uses one-way linked list internally to keep track of insertion order